next up previous
Next: Example using MPI (Fortran) Up: Examples for instrumented code Previous: Examples for instrumented code

A simple serial code in C

The following is a C version of the famous ``Hello World'' code. It has been instrumented to investigate the performance of the printf statement.

#include <stdio.h>
#include <stdlib.h>

#include "libhpm.h"

main(int argc, char *argv[]){

  hpmInit(0, "hpm_hello");

  hpmStart(1, "print_count");
  
  printf("Hello world!\n");

  hpmStop(1);

  hpmTerminate(0);

}



Joachim Hein
2003-11-03