[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
timing multiple processes
From: |
James M. Leddy |
Subject: |
timing multiple processes |
Date: |
Wed, 20 Feb 2008 18:17:28 -0500 |
User-agent: |
Thunderbird 2.0.0.9 (X11/20071115) |
Hi all,
Pardon the newb question, but is there any command for that will exec()
a command passed in on the command line $n times? I'm thinking of
something like:
for (int i = 0; i < 10; i++) {
pid = fork (); /* Run CMD as child process. */
if (pid < 0)
exit();
else if (pid == 0) {
execvp (cmd[0], cmd);
error (0, errno, "cannot run %s", cmd[0]);
_exit (errno == ENOENT ? 127 : 126);
}
}
if (pid != 0)
for (int i = 0; i < 10; i++)
wait(NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- timing multiple processes,
James M. Leddy <=