-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplexityAndScoreUtils.cpp
More file actions
38 lines (33 loc) · 1018 Bytes
/
ComplexityAndScoreUtils.cpp
File metadata and controls
38 lines (33 loc) · 1018 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
#include "stdafx.h"
#include "ComplexityAndScoreUtils.h"
Complexity utils::CalculateComplexity()
{
size_t complexity = 100000;
// TODO: Adjust base complexity accordingly to system specs
return complexity;
}
double utils::GetTestMethodComplexityRatio(TestMethod method)
{
switch(method)
{
case TestMethodCPU:
return 1;
case TestMethodMemory:
return 150;
case TestMethodCPUandMemory:
return 800;
default:
assert("Unknown test method");
return 1;
}
}
TheScore utils::CalculateTheScorePerThread(const StagesAverageResults& averageResults)
{
StageAverageResult average = std::accumulate(averageResults.begin(), averageResults.end(), 0);
average /= averageResults.size();
return average > 0 ? SCORE_STANDARD_DIVIDEND / average : 0;
}
TheScore utils::CalculateTheScoreMultithreaded(const StagesAverageResults& averageResults, size_t numberOfThreads)
{
return CalculateTheScorePerThread(averageResults) * numberOfThreads;
}