Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

measuring process/thread creation time

Status
Not open for further replies.

gotchausa

Programmer
Jan 24, 2002
64
CA
I need to write a couple of Unix scripts to measure the time to create a process and a thread in Unix. How may I go about this?
 
Wrong way to go about it IMHO.
You can't depend upon totally accurate information
concerning fork() or creating a thread from outside
the program. A start time init and callback internally
that does your measurement/error handling is how I'd approach it.

Otherwise from man 1 time:

NAME
time - time a simple command or give resource usage

SYNOPSIS
time [options] command [arguments...]

DESCRIPTION
The time command runs the specified program command with
the given arguments. When command finishes, time writes a
message to standard output giving timing statistics about
this program run. These statistics consist of (i) the
elapsed real time between invocation and termination, (ii)
the user CPU time (the sum of the tms_utime and tms_cutime
values in a struct tms as returned by times(2)), and (iii)
the system CPU time (the sum of the tms_stime and
tms_cstime values in a struct tms as returned by
times(2)).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top