Beispiel #1
0
Datei: app2.c Projekt: Aconex/pcp
int
main(int argc, char **argv)
{
    int	i, sts;

    prog = argv[0];
    srand48(time(0));
    /* uncomment this for debugging information */
    /* pmtracestate(PMTRACE_STATE_API|PMTRACE_STATE_COMMS|PMTRACE_STATE_PDU); */
    /* uncomment this to use the asynchronous protocol */
    /* pmtracestate(PMTRACE_STATE_ASYNC); */

    for (i = 0;; i++) {
	if ((sts = pmtracepoint("mainloop")) < 0) {
	    fprintf(stderr, "%s: mainloop point trace failed (%d): %s\n",
						prog, sts, pmtraceerrstr(sts));
	    exit(1);
	}
	switch(i % 3) {
	case 0:
	    time_sucker();
	    break;
	case 1:
	    io_sucker();
	    break;
	case 2:
	    cpu_sucker();
	    break;
	}
    }
}
Beispiel #2
0
int cpu_sucker_ruby( int on_time, int off_time ) {
  int RC;

  RC = fork();
  if (RC == 0) {
    RC = cpu_sucker( on_time, off_time );
    exit( 0 );
  } 

  return RC;
}