Measure User's Guide
Example of Measurement Application in C
Measure User’s Guide—520560-003
D-3
 if (Error != 0)
 {
 printf("MEASOPEN ERROR %d\n",Error);
 }
 printf("Configuring CPU measurement...\n");
 Error = MEASCONFIGURE((short *)&MeasCB,DataFNum,&MeasNum,
 (short *)&CPURec);
 if (Error != 0)
 {
 printf("MEASCONFIGURE ERROR %d\n",Error);
 }
 printf("Start Measurement %s",DataFName);
 Error = MEASCONTROL((short *)&MeasCB,MeasNum,
 CONVERTTIMESTAMP(JULIANTIMESTAMP(),0));
 if (Error != 0)
 {
 printf("MEASCONTROL ERROR %d\n",Error);
 }
 printf("Checking for active measurement...\n");
 Error = MEASMONSTATUS((short *)&MeasCB,&ActMeasNum,
 (short *)MeasNames);
 if (Error != 0)
 {
 printf("MEASMONSTATUS ERROR %d\n",Error);
 }
 printf("Checking CPU entity is being measured...\n");
 Error = MEASSTATUS((short 
*)&MeasCB,MeasNum,&cpus,&StartTime,
&StopTime,&Interval,Entities,CounterSpace);
 if (Error != 0)
 {
 printf("MEASSTATUS ERROR %d\n",Error);
 }
 printf("Stopping measurement...\n");
 Error = MEASCONTROL((short *)&MeasCB,MeasNum,-1,
 CONVERTTIMESTAMP(JULIANTIMESTAMP(),0));
 if (Error != 0)
 {
 printf("MEASCONTROL ERROR %d\n",Error);
 }
 printf("Closing Datafile...\n");
 Error = MEASCLOSE(DataFNum);
 if (Error != 0)
 {
 printf("MEASCLOSE ERROR %d\n",Error);
 }
Example D-1. Measurement Application in C (page3of4)










