Granulate / gprofiler

gProfiler is a system-wide profiler, combining multiple sampling profilers to produce unified visualization of what your CPU is spending time on.
https://profiler.granulate.io
Apache License 2.0
746 stars 54 forks source link

Improve get_process_golang_version() #696

Open Jongy opened 1 year ago

Jongy commented 1 year ago

The function accepts a psutil.Process and reads its /proc/pid/exe. It is cached on a per-Process basis, but Processes replace often and we can do smarter caching based on modification time of the absolute path of /proc/pid/exe based on the mnt ancestor, so /proc/{get_mnt_ns_ancestor(process)}/root/path/to/exe.

marcin-ol commented 1 year ago

I think it would be an improvement, but how do we know if we're referring to the right version of the exe file?

Let's assume I start ./helloworld as pid1, and N minutes later ./helloworld as pid2.

I think we need to look up modification time for exe file matching (not younger than) the create_time of the process. This should help with first bullet above, but not with forked processes.