diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-16 02:10:12 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-16 02:10:12 +0100 |
commit | af11f34fb52b68c6e68df097c43d594893c60f8d (patch) | |
tree | 89ad7465bdb0633d3f85230610bd6c249a615704 | |
parent | bd65bb67e25a79b019d745b7262b2008ce2adb15 (diff) |
perf logging for crypto rpc
-rw-r--r-- | src/cryptoApi.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cryptoApi.ts b/src/cryptoApi.ts index 2d2363770..dbadb45e4 100644 --- a/src/cryptoApi.ts +++ b/src/cryptoApi.ts @@ -187,8 +187,9 @@ export class CryptoApi { private doRpc<T>(operation: string, priority: number, ...args: any[]): Promise<T> { + let start = performance.now(); - return new Promise((resolve, reject) => { + let p = new Promise((resolve, reject) => { let rpcId = this.nextRpcId++; let workItem: WorkItem = {operation, args, resolve, reject, rpcId}; @@ -213,6 +214,11 @@ export class CryptoApi { throw Error("assertion failed"); }); + + return p.then((r) => { + console.log(`rpc ${operation} took ${performance.now() - start}ms`); + return r; + }); } |