Move metering report and tracer primitive to inner lib (#289)
* move inner metering to inner lib * remove duplicate getTicks from benchmarks folder
This commit is contained in:
parent
67fbd8c699
commit
07f96ec259
|
@ -6,25 +6,5 @@
|
|||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
when defined(amd64): # TODO defined(i386) but it seems like RDTSC call is misconfigured
|
||||
import platforms/x86
|
||||
export getTicks, cpuName
|
||||
|
||||
const SupportsCPUName* = true
|
||||
const SupportsGetTicks* = true
|
||||
else:
|
||||
const SupportsCPUName* = false
|
||||
const SupportsGetTicks* = false
|
||||
|
||||
# Prevent compiler optimizing benchmark away
|
||||
# -----------------------------------------------
|
||||
# This doesn't always work unfortunately ...
|
||||
|
||||
proc volatilize(x: ptr byte) {.codegenDecl: "$# $#(char const volatile *x)", inline.} =
|
||||
discard
|
||||
|
||||
template preventOptimAway*[T](x: var T) =
|
||||
volatilize(cast[ptr byte](unsafeAddr x))
|
||||
|
||||
template preventOptimAway*[T](x: T) =
|
||||
volatilize(cast[ptr byte](x))
|
||||
import ../constantine/platforms/metering/benchmarking
|
||||
export benchmarking
|
|
@ -4,8 +4,6 @@ author = "Mamy Ratsimbazafy"
|
|||
description = "This library provides thoroughly tested and highly-optimized implementations of cryptography protocols."
|
||||
license = "MIT or Apache License 2.0"
|
||||
|
||||
installDirs = @["constantine", "metering"]
|
||||
|
||||
# Dependencies
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# ############################################################
|
||||
|
||||
import ./primitives
|
||||
import ../../metering/tracer
|
||||
import ./metering/tracer
|
||||
|
||||
export primitives, tracer
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# Constantine
|
||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
||||
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
when defined(amd64): # TODO defined(i386) but it seems like RDTSC call is misconfigured
|
||||
import cycle_count/x86
|
||||
export getTicks, cpuName
|
||||
|
||||
const SupportsCPUName* = true
|
||||
const SupportsGetTicks* = true
|
||||
else:
|
||||
const SupportsCPUName* = false
|
||||
const SupportsGetTicks* = false
|
||||
|
||||
# Prevent compiler optimizing benchmark away
|
||||
# -----------------------------------------------
|
||||
# This doesn't always work unfortunately ...
|
||||
|
||||
proc volatilize(x: ptr byte) {.codegenDecl: "$# $#(char const volatile *x)", inline.} =
|
||||
discard
|
||||
|
||||
template preventOptimAway*[T](x: var T) =
|
||||
volatilize(cast[ptr byte](unsafeAddr x))
|
||||
|
||||
template preventOptimAway*[T](x: T) =
|
||||
volatilize(cast[ptr byte](x))
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
import
|
||||
std/[strformat, strutils],
|
||||
../benchmarks/platforms,
|
||||
tracer
|
||||
./benchmarking,
|
||||
./tracer
|
||||
|
||||
# Reporting benchmark result
|
||||
# -------------------------------------------------------
|
|
@ -20,7 +20,7 @@ const CTT_TRACE {.booldefine.} = off # For manual "debug-echo"-style timing.
|
|||
|
||||
when CTT_METER or CTT_TRACE:
|
||||
|
||||
import ../benchmarks/platforms
|
||||
import ./benchmarking
|
||||
|
||||
type
|
||||
Metadata* = object
|
|
@ -7,7 +7,7 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
import
|
||||
./reports, ./tracer,
|
||||
../constantine/platforms/metering/[reports, tracer],
|
||||
../constantine/ethereum_evm_precompiles,
|
||||
../constantine/platforms/abstractions
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import
|
||||
std/times,
|
||||
./reports, ./tracer,
|
||||
../constantine/platforms/metering/[reports, tracer],
|
||||
../constantine/math/config/curves,
|
||||
../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass],
|
||||
../constantine/math/constants/zoo_subgroups,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import
|
||||
std/times,
|
||||
./reports, ./tracer,
|
||||
../constantine/platforms/metering/[reports, tracer],
|
||||
../constantine/math/config/curves,
|
||||
../constantine/math/[arithmetic, extension_fields, ec_shortweierstrass],
|
||||
../constantine/math/constants/zoo_subgroups,
|
||||
|
|
Loading…
Reference in New Issue