[Cialug] Process timing

Todd Walton tdwalton at gmail.com
Wed Aug 19 14:36:54 UTC 2020


On Mon, Aug 17, 2020 at 8:48 PM Dave Weis <djweis at sjdjweis.com> wrote:

> Perhaps using strace with child logging but there's a good chance that the
> logging itself will skew the numbers.
>

strace has an option for this:
    -O overhead Set the overhead for tracing system calls to overhead
microseconds.  This is useful for overriding
        the default heuristic for guessing how much time is spent in mere
measuring when timing system calls using
        the -c option.  The accuracy of the heuristic can be gauged by
timing a given program run without tracing
        (using time(1)) and comparing the accumulated system call time to
the total produced using -c.

There's not enough real information on the goal to give more than a wild
> guess.
>

Yeah, like, do you want just total wall clock time for the program? Do you
want total time spent for all processes (so if the process spawns two child
processes and they each take two seconds, then the total should be
$time_of_parent + $time_of_child_1 + $time_of_child_2 = 2 + 2 + 2 = 6
seconds)? Do you want each child process broken out so that you know not
just total time but the time each child process took individually?

I don't see a way to do that last one, reliably. But the first two are
definitely feasible using time(1) and strace. For example, run "strace -cf
<cmd>".

--
Todd


More information about the Cialug mailing list