perf logging for crypto rpc
This commit is contained in:
parent
bd65bb67e2
commit
af11f34fb5
@ -187,8 +187,9 @@ export class CryptoApi {
|
|||||||
|
|
||||||
private doRpc<T>(operation: string, priority: number,
|
private doRpc<T>(operation: string, priority: number,
|
||||||
...args: any[]): Promise<T> {
|
...args: any[]): Promise<T> {
|
||||||
|
let start = performance.now();
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
let p = new Promise((resolve, reject) => {
|
||||||
let rpcId = this.nextRpcId++;
|
let rpcId = this.nextRpcId++;
|
||||||
let workItem: WorkItem = {operation, args, resolve, reject, rpcId};
|
let workItem: WorkItem = {operation, args, resolve, reject, rpcId};
|
||||||
|
|
||||||
@ -213,6 +214,11 @@ export class CryptoApi {
|
|||||||
|
|
||||||
throw Error("assertion failed");
|
throw Error("assertion failed");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return p.then((r) => {
|
||||||
|
console.log(`rpc ${operation} took ${performance.now() - start}ms`);
|
||||||
|
return r;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user