-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introduce scoped logging & revise debug print #34
Conversation
@Bryysen you might want to check this PR |
|
||
try bench.report(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to call Benchmark.report
anymore now that Benchmark.prettyPrint
displays the number of runs performed in the pretty-table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, good point. Should we rename prettyPrint
--> report
then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose? I don't have strong opinions on the naming either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented via 4a8462b
I'm still getting the "failed to open directory x" 😢 [****@**** index_map]$ zig build bench
warning(zbench_build): failed to open directory: util
benchmark runs time (avg ± σ) (min ............. max) p75 p99 p995
---------------------------------------------------------------------------------------------------------------------
... Looks good otherwise! |
lol now at least you know where that message is coming from ;-) I think the problem is |
Yeah the error/warning is a lot more descriptive now at least. Should we then first detect whether |
Not sure why this was introduced, maybe zig didn't detect tests in all files? In general, I think a straight-forward solution for such a case would be to do that same as is currently being done for the examples. That way, you don't miss a file plus you don't need to obtain the cwd 'manually'. Described it here in more detail. Besides, the build.zig will need a major revision for zig 0.12 anyway, a lot of changes seem to be made to the build-system right now. |
Yeah I wanted to have a more dynamic solution for the test setup, since you can have tests next to the code. And not having only dedicated test files like: I created a tracking issue for 0.12, so that we can already start migrating the codebase to 0.12. |
@Bryysen @FObersteiner please have a look into this PR, this should simplify the test setup. |
const version = std.SemanticVersion{ .major = 0, .minor = 1, .patch = 0 }; | ||
const log = std.log.scoped(.zbench_build); | ||
|
||
const version = std.SemanticVersion{ .major = 0, .minor = 1, .patch = 2 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bumping the version! 👍
060672b
into
hendriknielaender:main
I noticed that there are debug prints in the build script; those can mix in with other console output if
zbench
is an indirect dependency (e.g. my check_filetimes demo for zdt got a "Failed to open directory x" since zbench is used in zdt). Scoped logging should avoid this. See also : https://ziggit.dev/t/best-practices-writing-to-stdout/2760Also, there seems to be mix of printing to stdout and stderr (std.debug.print). IMHO, this should be stdout only since we do not want to signal errors when running benchmarks (stderr output can be interpreted as exit(1)).