Files
compute-runtime/opencl/test/unit_test/perf_tests/perf_test_utils.h
Mateusz Jablonski 7df9945ebe Add absolute include paths
Change-Id: I67a6919bbbff1d30c7d6cdb257b41c87bad51e7f
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2020-02-23 23:49:12 +01:00

46 lines
939 B
C++

/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/utilities/timer_util.h"
#include "gtest/gtest.h"
#include <stdint.h>
extern const char *perfLogPath;
extern long long refTime;
void setReferenceTime();
bool getTestRatio(uint64_t hash, double &ratio);
bool saveTestRatio(uint64_t hash, double ratio);
bool isInRange(double data, double reference, double rangePercentage);
bool isLowerThanReference(double data, double reference, double rangePercentage);
bool updateTestRatio(uint64_t hash, double ratio);
template <typename T>
T majorityVote(T time1, T time2, T time3) {
T minTime1 = 0;
T minTime2 = 0;
if (time1 < time2) {
minTime1 = time1;
minTime2 = time2;
} else {
minTime1 = time2;
minTime2 = time1;
}
if (minTime2 > time3)
minTime2 = time3;
return (minTime1 + minTime2) / 2;
}