-
Notifications
You must be signed in to change notification settings - Fork 58
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
Added ability for bcfg2-info to output stats results to a file #56
base: maint
Are you sure you want to change the base?
Conversation
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Conflicts: src/lib/Server/Lint/Comments.py src/lib/Server/Plugin.py
…s plugin not enabled
…age or Package tags
Conflicts: src/lib/Server/Plugins/Packages/Collection.py src/lib/Server/Plugins/Packages/Yum.py
Is there a reason we can't just print this data to stdout and let the user redirect it whereve they want? |
the current implementation doesn't actually generate the pstats object, which can be queried and printed in a variety of ways. The output, as currently provided by the bcfg2-info profile command, only prints the first 200 lines, ordered by cumulative time, calls and the time. http://docs.python.org/2/library/profile.html#the-stats-class describes the various other ways you can order the statistics. |
Would this be better implemented as an option to select the stats output
|
I think this certainly can be added as a feature, but there is still value with stowing the stats object away. Once saved, you can look at different views on the same profile without re-running the whole bcfg2-info command. |
Why wouldn't output redirection work for that portion of this feature? It
|
This change generates a file that isn't simply the text that the bcfg2-info profile command generates. It's actually a complex data structure that you need to use the python pstats module to produce the output. The output of the bcfg2-info profile command is rather limited in comparison. Running the bcfg2-info profile command is a boringly tedious command, takes over a minute on my test system, and if I had to use it to generate output for every different permutation of output I'd want to look at, I'd be spending more time twiddling my thumbs than debugging, and there's no guarantee that the second iteration of the profile isn't affected by some other system bottleneck making it useless as a comparison. For example, to evaluate the stats file generated by this (or the cProfile.py script included in Python), run: Is there some reason you are so against this kind of profiling tool? I've found it rather useful. |
I think we're talking past each other. I think adding better profiling is
|
I looked into this a little more, and now I get why you're dumping the stats to a file. I didn't realize that a) dump_stats() could only dump to a file (not even a StringIO object); and b) that the dumped stats are really only useful as a standalone file -- piping a marshaled stats object through something doesn't really make any sense. I would like a couple of fairly minor changes:
Or, if we change it to just taking a filename:
Thanks. Sorry I was so thick-headed about this. |
In order to do some more efficient profiling of bcfg2 I added a feature to output the pstats information to a file for later analysis.