aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/test-utils/src/profiler.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-11-23 21:03:48 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-12-03 19:09:28 +0800
commit0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4 (patch)
tree1d1f4ec74287ff12e305a18fee459772345c2ff1 /contracts/test-utils/src/profiler.ts
parent450c72035f13b02cb3cbd24f68a9fcb743aceb26 (diff)
downloaddexon-sol-tools-0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4.tar
dexon-sol-tools-0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4.tar.gz
dexon-sol-tools-0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4.tar.bz2
dexon-sol-tools-0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4.tar.lz
dexon-sol-tools-0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4.tar.xz
dexon-sol-tools-0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4.tar.zst
dexon-sol-tools-0faa8b3231ddfc15723a4bdda0b6ed7aeb742bd4.zip
Refactor contracts-core into contracts-multisig, contracts-core and contracts-test-utils
Diffstat (limited to 'contracts/test-utils/src/profiler.ts')
-rw-r--r--contracts/test-utils/src/profiler.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/contracts/test-utils/src/profiler.ts b/contracts/test-utils/src/profiler.ts
new file mode 100644
index 000000000..2c7c1d66c
--- /dev/null
+++ b/contracts/test-utils/src/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;
+ },
+};