Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

instrumentation_test.c

Go to the documentation of this file.
00001 /*
00002  * instrumentation_test.c
00003  *
00004  * Copyright (c) 2003, 2004 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file instrumentation_test.c
00014  *
00015  * Test the instrumentation infrastructure.
00016  */
00017 
00018 #include "config.h"
00019 
00020 #include <stdlib.h>
00021 
00022 #include "instrumentation.h"
00023 
00024 #if defined(INSTR_test_data)
00025 static struct iPoint INSTR_test_point = {
00026     INSTR_test_data
00027 };
00028 #endif
00029 
00030 int main(int argc, char *argv[])
00031 {
00032     int retval = 0;
00033 
00034     instrumentation_data.iid_OutputFileName = "-";
00035     atexit(iPrintPointsAtExit);
00036 
00037     {
00038         static double hrtime_test_history[8];
00039         static struct iPoint hrtime_test_point = {
00040             "hrtime",
00041             "test of hrtime() function",
00042             IPF_PRINT_HISTORY,
00043             IPOINT_INIT_HISTORY(hrtime_test_history),
00044             "%8.0f  ",
00045         };
00046 
00047         hrtime_t start, end;
00048         int lpc;
00049         
00050         for( lpc = 0; lpc < 10; lpc++ )
00051         {
00052             volatile int delay;
00053             
00054             start = hrtime();
00055             for( delay = 0; delay < 1000; delay++ );
00056             end = hrtime();
00057             iPostFloatData(&hrtime_test_point, (end - start));
00058         }
00059     }
00060 
00061     INSTR_test(&INSTR_test_point, {
00062         printf("Hello, World!\n");
00063     });
00064 
00065     INSTR_notest(&INSTR_notest_point, {
00066         printf("Goodbye, World!\n");
00067     });
00068     
00069     return( retval );
00070 }

Generated on Fri Oct 22 07:50:24 2004 for CPU Broker by  doxygen 1.3.9.1