diff options
author | 2019-09-27 22:30:33 +0200 | |
---|---|---|
committer | 2019-09-27 22:30:33 +0200 | |
commit | ce612896a88be5a2cd6887f0ad569901fcbe0926 (patch) | |
tree | 64460ba27223208369461613938bfc9cf7119ed6 /src/lib/netlist/plib/pchrono.cpp | |
parent | 28192a5a65e6bc9d143ab8ccb64589e414847a94 (diff) |
netlist: Fix a number of minor issues. (nw)
- lint warnings
- remove const on return types
Diffstat (limited to 'src/lib/netlist/plib/pchrono.cpp')
-rw-r--r-- | src/lib/netlist/plib/pchrono.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/netlist/plib/pchrono.cpp b/src/lib/netlist/plib/pchrono.cpp index f89df7dba07..354a2589851 100644 --- a/src/lib/netlist/plib/pchrono.cpp +++ b/src/lib/netlist/plib/pchrono.cpp @@ -1,14 +1,40 @@ // license:GPL-2.0+ // copyright-holders:Couriersud +#if 0 + #include "pchrono.h" namespace plib { namespace chrono { #if defined(__x86_64__) && !defined(_clang__) && !defined(_MSC_VER) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)) +template <typename T> +auto per_sec() -> typename T :: type +{ + using ret_type = typename T :: type; + static ret_type persec = 0; + if (persec == 0) + { + ret_type x = 0; + system_ticks::type t = system_ticks::start(); + system_ticks::type e; + x = - T :: start(); + do { + e = system_ticks::stop(); + } while (e - t < system_ticks::per_second() / 100 ); + x += T :: stop(); + persec = (ret_type)(double)((double) x * (double) system_ticks::per_second() / double (e - t)); + } + return persec; +} + + fast_ticks::type fast_ticks::per_second() { +#if 1 + return per_sec<fast_ticks>(); +#else static type persec = 0; if (persec == 0) { @@ -23,6 +49,7 @@ fast_ticks::type fast_ticks::per_second() persec = (type)(double)((double) x * (double) system_ticks::per_second() / double (e - t)); } return persec; +#endif } #if PUSE_ACCURATE_STATS && PHAS_RDTSCP @@ -49,3 +76,4 @@ exact_ticks::type exact_ticks::per_second() } // namespace chrono } // namespace plib +#endif |