From: Taras Glek <tglek@mozilla.com>
To: linux-kernel@vger.kernel.org
Subject: Measuring startup-time from userspace
Date: Sun, 02 Jan 2011 14:40:48 -0800 [thread overview]
Message-ID: <4D20FEF0.5020206@mozilla.com> (raw)
Hi,
Does Linux provide a reasonable way to measure how long a process has
existed for? The goal is to have a function that returns the number of
milliseconds since process-creation.
We'd like to be able to have Firefox self-diagnose startup times.
Unfortunately, it turns out that library loading time adds a lot to
startup before application code runs, so a in-application timer would
underestimate startup time.
It appears that the most precise solution is to read start time from
/proc/self/stat. Unfortunately the time is in jiffies-since-startup and
there don't seem to be any good counters to compare against (ie
/proc/uptime doesn't provide enough resolution). So far the only
workable solution seems to create a new thread/process. Then one can do
(/proc/<newpid>/stat.starttime - /proc/self/stat.starttime) * 1000 / HZ
.
The question is, there way for a process to measure time-since-startup
without horrible hacks like spawning a new processes?
Taras
ps. Perhaps /proc/timer_list contains enough info?
next reply other threads:[~2011-01-02 23:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-02 22:40 Taras Glek [this message]
2011-01-03 1:29 ` Measuring startup-time from userspace Ben Gamari
2011-01-03 5:12 ` Alexander Clouter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D20FEF0.5020206@mozilla.com \
--to=tglek@mozilla.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox