Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upLet's talk profiling (again) #296
Comments
This comment has been minimized.
This comment has been minimized.
Hey, thanks for the suggestion. I can see you've put some thought into this, and I think your implementation ideas are reasonable. I was already planning a trait to allow external crates to plug in different measurements and such, so this would fit in well with the designs for 0.3.0 in #261. Providing hooks to notify the profiler when each sample starts/ends seems to me like the right way to go. That should prevent much of the measurement machinery from showing up in the profiles. Criterion.rs should also provide a path to the benchmark directory so the profiler can store its data there. As for including the profiler's results in the HTML reports, that would take some careful design. It's tempting to just call a function that returns some HTML text but I suspect that plugins would want a more powerful way to customize the reports so I'd prefer to build something more general. On the other hand, without examples of what they might want it's hard to know what would be appropriate. |
This comment has been minimized.
This comment has been minimized.
I'll be reading through that issue. Thanks for the support!
Good thinking on the path.
Maybe we can postpone this with a future extension of the trait, since this is quite a specialized thing to do. I can see e.g. the profiler hooking into the parameters of a benchmark and highlighting differences somehow in the far future. |
This comment has been minimized.
This comment has been minimized.
I've added support for profiler hooks to the @rubdos - Could you try implementing a profiler hook to connect to |
This comment has been minimized.
This comment has been minimized.
I currently am not profiling anything, but I hope to have something soon to test this on. Thanks for everything already!
Good, I was about to ask that! At first sight, your docs make sense. |
Hi, and thanks for this great library!
There have been quite a number of suggestions to incorporate profiling in Criterion.rs: e.g. #138, #274. In the former, @bheisler writes:
To sketch why I would love a more tight integration: I am currently hopping back and forth between commenting out
cpuprofiler::PROFILER::...
lines and runningcargo bench
, and uncommenting the line and runningcargo bench --profile-time 10
. It would thus be nice that the profiler only and automatically gets activated when running criterion in profile mode.So, I opened this issue to discuss what features such "interface" should contain, and then to see how to design such interface. I'd happily dedicate some of my time to help making this a reality.
Features that I am thinking about:
cpuprofiler
requests a filename to dump thegperf
data;In terms of implementation: I think we (or an external crate) could export a
trait Profiler
that can be implemented by different profiling systems that contains the necessary methods to accomplish the above? That way, no actual profiling code has to be in Criterion.rs.Thoughts?