thanks but even this solution is not working ..as i m not having IBM ....can u suggest something else??
I see...In that link they are using non - std libraries ! can use standard c libraries like time.h and pass your cmd into some c code, of course need to be compiled.
Try this example (I've tried on HP-UX):
- #include <stdio.h>
-
#include <time.h>
-
#include <stdlib.h>
-
-
main ()
-
-
-
{
-
double p,q,diff;
-
-
q = ((double)clock())/CLOCKS_PER_SEC;
-
system("ls -l");
-
p = ((double)clock())/CLOCKS_PER_SEC;
-
diff = p - q ;
-
printf("\n%e\n",diff);
-
q = ((double)clock())/CLOCKS_PER_SEC;
-
system("netstat -a");
-
p = ((double)clock())/CLOCKS_PER_SEC;
-
diff = p - q ;
-
printf("\n%e\n", diff);
-
printf("\n%i\n",CLOCKS_PER_SEC);
-
-
return 0;
-
-
}
-system calls sh executing the cmd inside ""
-clock() returns the number of CPU clocks since the program started
-CLOCKS_PER_SEC gives the number of clocks in one sec (1000000 typically)
-p,q,diff are expressed in seconds
-"ls -l" has quite a short exe time compared to "netstat -a"