
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] Giving a program priority briefly
Curt Sampson writes:
> You'll probably get much more consistent times from [time ./myprog],
> even if your real time varies a lot based on load. This, while far
> from perfect, is a fine method of making sure you haven't screwed
> up something big time as you make changes.
You always get at least system vs. user time (POSIX spec), but GNU
time has a slew of additional features. Also, you want to know the
characteristics of the OS. Some OSes do a pretty poor job of such
profiling (IIRC the sum of user + system on Mac OS X can exceed 100%
of wall clock time); you may need to instrument the program itself to
get accurate results (although that often introduces Heisenbugs that
skew overall performance).
As Curt says, though, it's a fine method, and works well most of the
time.
> If that doesn't work for you, because you've got important cache issues,
> or you need to benchmark disk I/O as well, or whatever else, well, now
> you've probably got a lot more work cut out for you.
GNU time can help with that, as it will give information on page
faults and lots of other stuff. See also getrusage: you could use
that information to compute resource usage by specific routines. Read
the documentation carefully, though: the structure returned is
compatible with other Unices, and your OS may not maintain all of the
members.
Home |
Main Index |
Thread Index