Logo Search packages:      
Sourcecode: callgrind version File versions

hugecallcount.c

#include <stdio.h>

__attribute__ ((regparm (1)))
int func1(int a)
{
    return a;
}

__attribute__ ((regparm (1)))
int func2(int a)
{
    a = func1(a);
    a = func1(a);
    a = func1(a);
    a = func1(a);
    a = func1(a);

    a = func1(a);
    a = func1(a);
    a = func1(a);
    a = func1(a);
    a = func1(a);

    return a;
}

__attribute__ ((regparm (1)))
int func3(int a)
{
    a  = func2(a);
    a  = func2(a);
    a  = func2(a);
    a  = func2(a);
    a  = func2(a);

    a  = func2(a);
    a  = func2(a);
    a  = func2(a);
    a  = func2(a);
    a  = func2(a);

    return a;
}


int main()
{
    int a = 5;
    int c = 0;
    int i = 0;

    while(1) {
      a += func3(a);
      if (++c >= 1000000) {
          c=0;
          printf("Hallo!\n"); 
          if (++i > 45) return 0;
      }
    }
}

Generated by  Doxygen 1.6.0   Back to index