2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2020-2021 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
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
|
|
|
#include "shared/source/os_interface/os_time.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-05-21 01:49:44 +08:00
|
|
|
#include <memory>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
class OSTimeLinux : public OSTime {
|
|
|
|
public:
|
2021-05-21 01:49:44 +08:00
|
|
|
OSTimeLinux(OSInterface *osInterface, std::unique_ptr<DeviceTime> deviceTime);
|
2017-12-21 07:45:38 +08:00
|
|
|
bool getCpuTime(uint64_t *timeStamp) override;
|
|
|
|
double getHostTimerResolution() const override;
|
|
|
|
uint64_t getCpuRawTimestamp() override;
|
|
|
|
|
2021-05-28 01:44:47 +08:00
|
|
|
static std::unique_ptr<OSTime> create(OSInterface *osInterface, std::unique_ptr<DeviceTime> deviceTime);
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
protected:
|
|
|
|
typedef int (*resolutionFunc_t)(clockid_t, struct timespec *);
|
|
|
|
typedef int (*getTimeFunc_t)(clockid_t, struct timespec *);
|
|
|
|
resolutionFunc_t resolutionFunc;
|
|
|
|
getTimeFunc_t getTimeFunc;
|
|
|
|
};
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|