2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2018-09-18 15:11:08 +08:00
|
|
|
* Copyright (C) 2017-2018 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/os_interface/os_time.h"
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
class MockOSTime : public OSTime {
|
|
|
|
public:
|
|
|
|
bool getCpuGpuTime(TimeStampData *pGpuCpuTime) override {
|
|
|
|
static int PerfTicks = 0;
|
|
|
|
pGpuCpuTime->GPUTimeStamp = ++PerfTicks;
|
|
|
|
pGpuCpuTime->CPUTimeinNS = PerfTicks;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool getCpuTime(uint64_t *timeStamp) override {
|
|
|
|
static int PerfTicks = 0;
|
|
|
|
*timeStamp = ++PerfTicks;
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
double getHostTimerResolution() const override {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
double getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) const override {
|
|
|
|
return OSTime::getDeviceTimerResolution(hwInfo);
|
|
|
|
}
|
|
|
|
uint64_t getCpuRawTimestamp() override {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static std::unique_ptr<OSTime> create() {
|
|
|
|
return std::unique_ptr<OSTime>(new MockOSTime());
|
|
|
|
}
|
|
|
|
};
|
2018-06-13 03:54:39 +08:00
|
|
|
} // namespace OCLRT
|