We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The solution is to read btime from /proc/stat (once) and calculate process_start_time_seconds as
btime
/proc/stat
long jiffies_per_second; jiffies_per_second=sysconf(_SC_CLK_TCK); process_start_time_seconds = btime + stat->starttime / jiffies_per_second;
The text was updated successfully, but these errors were encountered:
I create a gist what reads btime from stats
C is not my main language, I not sure where to put a readbtime function in the libprom sources.
readbtime
Sorry, something went wrong.
it seems to read /proc/{pid}/stats which according to https://man7.org/linux/man-pages/man5/proc.5.html needs to be handled roughly as you described.
/proc/{pid}/stats
it is read in https://github.com/digitalocean/prometheus-client-c/blob/master/prom/src/prom_process_stat.c#L164 with sscanf. process_cpu_total_seconds already has some conversion code in https://github.com/digitalocean/prometheus-client-c/blob/master/prom/src/prom_collector.c#L225.
process_cpu_total_seconds
and i guess we could patch it in https://github.com/digitalocean/prometheus-client-c/blob/master/prom/src/prom_collector.c#L249
No branches or pull requests
The solution is to read
btime
from/proc/stat
(once) and calculate process_start_time_seconds asThe text was updated successfully, but these errors were encountered: