aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c
blob: 2f65d4e43e763cbb4c07f5044855677774f9208f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* { dg-options "-O2 -fdump-ipa-profile --param=profile-values-time=1" } */

#include <unistd.h>

__attribute__ ((noinline))
int foo()
{
  return 1;
}

__attribute__ ((noinline))
int bar()
{
  return 1;
}

__attribute__ ((noinline))
int baz()
{
  return 1;
}

__attribute__ ((noinline))
int baz1()
{
  return 1;
}

int main ()
{
  int f = fork();
  int r = 0;

  foo ();

  if (f < 0)
    return 1; /* Fork failed.  */

  if(f == 0) /* Child process.  */
    r = bar() - foo();
  else /* Parent process.  */
    r = foo() - foo();

  return r;
}
/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 0" 2 "profile"} } */
/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */
/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */
/* { dg-final-use { scan-ipa-dump-times "Read tp_first_run: 3" 1 "profile"} } */
/* { dg-final-use { cleanup-ipa-dump "profile" } } */