gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-wallet-webex] branch master updated: measure time fo


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated: measure time for the operation only while not in queue
Date: Tue, 12 Dec 2017 22:49:10 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-webex.

The following commit(s) were added to refs/heads/master by this push:
     new 5a8d880e measure time for the operation only while not in queue
5a8d880e is described below

commit 5a8d880ebd53d6436e78c9f242d20bfa3f50b8b8
Author: Florian Dold <address@hidden>
AuthorDate: Tue Dec 12 22:49:04 2017 +0100

    measure time for the operation only while not in queue
---
 src/crypto/cryptoApi.ts | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/crypto/cryptoApi.ts b/src/crypto/cryptoApi.ts
index d0ba6ada..9a21d13a 100644
--- a/src/crypto/cryptoApi.ts
+++ b/src/crypto/cryptoApi.ts
@@ -73,6 +73,11 @@ interface WorkItem {
    * Serial id to identify a matching response.
    */
   rpcId: number;
+
+  /**
+   * Time when the work was submitted to a (non-busy) worker thread.
+   */
+  startTime: number;
 }
 
 
@@ -117,6 +122,7 @@ export class CryptoApi {
       operation: work.operation,
     };
     this.resetWorkerTimeout(ws);
+    work.startTime = timer.performanceNow();
     ws.w!.postMessage(msg);
   }
 
@@ -187,6 +193,7 @@ export class CryptoApi {
       console.error(`RPC with id ${id} has no registry entry`);
       return;
     }
+    console.log(`rpc ${currentWorkItem.operation} took 
${timer.performanceNow() - currentWorkItem.startTime}ms`);
     currentWorkItem.resolve(msg.data.result);
   }
 
@@ -216,11 +223,10 @@ export class CryptoApi {
 
   private doRpc<T>(operation: string, priority: number,
                    ...args: any[]): Promise<T> {
-    const start = timer.performanceNow();
 
     const p: Promise<T> = new Promise<T>((resolve, reject) => {
       const rpcId = this.nextRpcId++;
-      const workItem: WorkItem = {operation, args, resolve, reject, rpcId};
+      const workItem: WorkItem = {operation, args, resolve, reject, rpcId, 
startTime: 0};
 
       if (this.numBusy === this.workers.length) {
         const q = this.workQueues[priority];
@@ -244,7 +250,6 @@ export class CryptoApi {
     });
 
     return p.then((r: T) => {
-      console.log(`rpc ${operation} took ${timer.performanceNow() - start}ms`);
       return r;
     });
   }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]