aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/core/test/utils/profiler.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-11-22 21:52:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-12-03 18:31:53 +0800
commit4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004 (patch)
tree43cad9046ecc4c9e59e9d9743c6f076878881037 /contracts/core/test/utils/profiler.ts
parent502e9c7be48caafd7725451789f896efdaf17dac (diff)
downloaddexon-0x-contracts-4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004.tar.gz
dexon-0x-contracts-4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004.tar.zst
dexon-0x-contracts-4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004.zip
Move packages/contracts to contracts/core
Diffstat (limited to 'contracts/core/test/utils/profiler.ts')
-rw-r--r--contracts/core/test/utils/profiler.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/contracts/core/test/utils/profiler.ts b/contracts/core/test/utils/profiler.ts
new file mode 100644
index 000000000..2c7c1d66c
--- /dev/null
+++ b/contracts/core/test/utils/profiler.ts
@@ -0,0 +1,27 @@
+import { devConstants } from '@0x/dev-utils';
+import { ProfilerSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-cov';
+import * as _ from 'lodash';
+
+let profilerSubprovider: ProfilerSubprovider;
+
+export const profiler = {
+ start(): void {
+ profiler.getProfilerSubproviderSingleton().start();
+ },
+ stop(): void {
+ profiler.getProfilerSubproviderSingleton().stop();
+ },
+ getProfilerSubproviderSingleton(): ProfilerSubprovider {
+ if (_.isUndefined(profilerSubprovider)) {
+ profilerSubprovider = profiler._getProfilerSubprovider();
+ }
+ return profilerSubprovider;
+ },
+ _getProfilerSubprovider(): ProfilerSubprovider {
+ const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
+ const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
+ const isVerbose = true;
+ const subprovider = new ProfilerSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose);
+ return subprovider;
+ },
+};