On Tue, 14 May 2019 10:55:40 -0300, Pedro Terra Delboni said: > Regarding bpftrace: This seemed like the best option since I could use it > to count frames of the stack with depth 2, allowing me to know precisely > the amount of times each specific call has been made. However, I could not > use it because since I have to probe every function, it would raise an > error related to open file limit. I've tried setting the open file limit to > unlimited, but the command I used to do so said it was impossible, also the > current limit is set to 1048576, so I'm guessing that probing every > function isn't a viable solution. What problem are you trying to solve? If you're trying to count how often *every* function is called, and the fact that one way to do it has an upper limit of a million is a problem, chances are that you haven't figured out what the *question* is yet. Usually, the number of calls isn't that important, the total runtime spent in the function is important. A one-liner inline accessor function that compiles down to 2-3 machine opcodes can be called tens of thousands of times a second and not be noticed. A function that takes milliseconds to complete will be noticed if it's called only a few dozen times a second. If you're trying to figure out how the functions fit together, a static call graph analysis tool to produce a map of what calls what may be what you need. Having said that, a kernel built with gcov or ftrace support will give you the info you need. See kernel/gcove/Kconfig and http://heim.ifi.uio.no/~knuto/kernel/4.14/dev-tools/gcov.html if you want to go that route. Resources for ftrace call counts: http://www.brendangregg.com/blog/2014-07-13/linux-ftrace-function-counting.html https://wiki.linaro.org/KenWerner/Sandbox/ftrace and see section 'function profiler'. Be prepared for your kernel to be quite slow, and have to do a *lot* of data reduction. Note that you'll probably need to run for at least several hours, and of course the function counts will be *very* dependent on what you do - what gets called while I'm doing stuff like writing e-mail is very different from what happens during a kernel compile, and both of those are different from the function counts that happen when I back up my laptop to an external USB disk. (Note I've not *tried* any of the above - this laptop is slow enough as it is :)
Attachment:
pgp7MJuSqrGV1.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies