Re: Measuring startup-time from userspace

From: Alexander Clouter
Date: Mon Jan 03 2011 - 00:16:14 EST


Taras Glek <tglek@xxxxxxxxxxx> wrote:
>
> 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.
>
At a glance:
----
alex@berk:~$ stat /proc/16863/
File: `/proc/16863/'
Size: 0 Blocks: 0 IO Block: 1024 directory
Device: 3h/3d Inode: 837808 Links: 6
Access: (0555/dr-xr-xr-x) Uid: ( 1000/ alex) Gid: ( 1000/ alex)
Access: 2011-01-03 05:07:47.888363341 +0000
Modify: 2011-01-03 05:07:47.888363341 +0000
Change: 2011-01-03 05:07:47.888363341 +0000
----

A nanosecond resolution timestamp for the moment when the pid is created
it seems. I could be completely wrong, but this seems to be one of
those "too easy to be true" moments.

Cheers

--
Alexander Clouter
.sigmonster says: Marriage is the sole cause of divorce.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/