summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pconfig.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/plib/pconfig.h')
-rw-r--r--src/lib/netlist/plib/pconfig.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h
index 82c71c2f2a8..787bcede422 100644
--- a/src/lib/netlist/plib/pconfig.h
+++ b/src/lib/netlist/plib/pconfig.h
@@ -9,6 +9,8 @@
#define PCONFIG_H_
#include <cstdint>
+#include <thread>
+#include <chrono>
#ifndef PSTANDALONE
#define PSTANDALONE (0)
@@ -25,6 +27,8 @@ typedef __uint128_t UINT128;
typedef __int128_t INT128;
#endif
+#define PLIB_NAMESPACE_START() namespace plib {
+#define PLIB_NAMESPACE_END() }
#if !(PSTANDALONE)
#include "osdcomm.h"
@@ -135,6 +139,29 @@ typedef int64_t INT64;
#endif
+using pticks_t = INT64;
+
+inline pticks_t pticks()
+{
+ return std::chrono::high_resolution_clock::now().time_since_epoch().count();
+}
+inline pticks_t pticks_per_second()
+{
+ return std::chrono::high_resolution_clock::period::den / std::chrono::high_resolution_clock::period::num;
+}
+
+#if 1 && defined(__x86_64__)
+
+static inline pticks_t pprofile_ticks()
+{
+ unsigned hi, lo;
+ __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+ return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
+}
+#else
+inline pticks_t pprofile_ticks() { return pticks(); }
+#endif
+
/*
* The following class was derived from the MAME delegate.h code.
* It derives a pointer to a member function.