Export OS correctly
This commit is contained in:
@@ -26,11 +26,12 @@ SOFTWARE.
|
|||||||
#include <pd/core/common.hpp>
|
#include <pd/core/common.hpp>
|
||||||
#include <pd/core/timetrace.hpp>
|
#include <pd/core/timetrace.hpp>
|
||||||
#include <pd/drivers/types.hpp>
|
#include <pd/drivers/types.hpp>
|
||||||
|
#include <pd/pd_p_api.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
using TraceMap = std::map<std::string, TT::Res::Ref>;
|
using TraceMap = std::map<std::string, TT::Res::Ref>;
|
||||||
|
|
||||||
class OsDriver {
|
class PD_API OsDriver {
|
||||||
public:
|
public:
|
||||||
OsDriver(const std::string& name = "StdPd") : pName(name) {}
|
OsDriver(const std::string& name = "StdPd") : pName(name) {}
|
||||||
OsDriver(PDDriverData data) : pName("StdPd") {}
|
OsDriver(PDDriverData data) : pName("StdPd") {}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ SOFTWARE.
|
|||||||
#include <pd/drivers/os.hpp>
|
#include <pd/drivers/os.hpp>
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
TT::Res::Ref& OsDriver::GetTraceRef(const std::string& id) {
|
PD_API TT::Res::Ref& OsDriver::GetTraceRef(const std::string& id) {
|
||||||
if (!pTraces.count(id)) {
|
if (!pTraces.count(id)) {
|
||||||
pTraces[id] = TT::Res::New();
|
pTraces[id] = TT::Res::New();
|
||||||
pTraces[id]->SetID(id);
|
pTraces[id]->SetID(id);
|
||||||
@@ -32,18 +32,18 @@ TT::Res::Ref& OsDriver::GetTraceRef(const std::string& id) {
|
|||||||
return pTraces[id];
|
return pTraces[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceMap& OsDriver::GetTraceMap() { return pTraces; }
|
PD_API TraceMap& OsDriver::GetTraceMap() { return pTraces; }
|
||||||
|
|
||||||
bool OsDriver::TraceExist(const std::string& id) { return pTraces.count(id); }
|
PD_API bool OsDriver::TraceExist(const std::string& id) { return pTraces.count(id); }
|
||||||
|
|
||||||
/** Standart Driver */
|
/** Standart Driver */
|
||||||
u64 OsDriver::GetTime() {
|
PD_API u64 OsDriver::GetTime() {
|
||||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::steady_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
.count();
|
.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 OsDriver::GetNanoTime() {
|
PD_API u64 OsDriver::GetNanoTime() {
|
||||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||||
std::chrono::steady_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
.count();
|
.count();
|
||||||
|
|||||||
Reference in New Issue
Block a user