-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmain.cpp
53 lines (38 loc) · 849 Bytes
/
main.cpp
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
51
52
//
// main.cpp
// libProfiler
//
// Created by Cedric Guillemet on 12/23/12.
// Copyright (c) 2012 Cedric Guillemet. All rights reserved.
//
#include <iostream>
#include <math.h>
void myPrintf( const char *szText )
{
printf("Profiler:%s", szText);
}
#define USE_PROFILER 1
#define LIB_PROFILER_IMPLEMENTATION
#define LIB_PROFILER_PRINTF myPrintf
#include "libProfiler.h"
void myFunction()
{
PROFILER_START(myFunction);
float v = 0;
for(int i = 0;i<1000000;i++)
v += cosf(static_cast<float>(rand()));
printf("v = %5.4f\n", v);
PROFILER_END();
}
int main(int argc, const char * argv[])
{
PROFILER_ENABLE;
PROFILER_START(Main);
std::cout << "Hello, World!\n";
myFunction();
myFunction();
PROFILER_END();
LogProfiler();
PROFILER_DISABLE;
return 0;
}