-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (30 loc) · 842 Bytes
/
main.cpp
File metadata and controls
42 lines (30 loc) · 842 Bytes
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
#include <melatonin_perfetto/melatonin_perfetto.h>
#include <juce_core/juce_core.h>
#include <memory>
#include <vector>
#include <cstdlib>
#if ! PERFETTO
#error PERFETTO must be 1 for this test!
#endif
int szudzikPair (int a, int b)
{
TRACE_DSP();
const auto A = a >= 0 ? 2 * a : -2 * a - 1;
const auto B = b >= 0 ? 2 * b : -2 * b - 1;
if (A >= B)
return A * A + A + B;
return A + B * B;
}
int main (int, char**)
{
MelatoninPerfetto tracingSession;
auto& rand = juce::Random::getSystemRandom();
// we want to make sure these function calls don't get optimized away
std::vector<int> values;
for (auto i = 0; i < 100; ++i)
values.push_back (szudzikPair (rand.nextInt(), rand.nextInt()));
const auto dumpFile = tracingSession.endSession();
if (dumpFile.existsAsFile())
return EXIT_SUCCESS;
return EXIT_FAILURE;
}