From 08c0f232ff30188f65beec429948805a4b636f3e Mon Sep 17 00:00:00 2001
From: Yulong Wang <7679871+fs-eire@users.noreply.github.com>
Date: Wed, 11 Oct 2023 17:29:57 -0700
Subject: [PATCH] revise program-manager.ts

---
 js/web/lib/wasm/jsep/webgpu/program-manager.ts | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/js/web/lib/wasm/jsep/webgpu/program-manager.ts b/js/web/lib/wasm/jsep/webgpu/program-manager.ts
index 33c67159b9988..75f4ae3ab6100 100644
--- a/js/web/lib/wasm/jsep/webgpu/program-manager.ts
+++ b/js/web/lib/wasm/jsep/webgpu/program-manager.ts
@@ -90,12 +90,11 @@ export class ProgramManager {
 
       const kernelId = this.backend.currentKernelId!;
       const kernelInfo = this.backend.kernels.get(kernelId)!;
-      const kernelName = `[${kernelInfo[0]}] ${kernelInfo[1]}`;
 
       syncData.buffer.mapAsync(GPUMapMode.READ).then(() => {
         const mappedData = new BigUint64Array(syncData.buffer.getMappedRange());
-        const startTimeU64 = mappedData[0];
-        const endTimeU64 = mappedData[1];
+        const [startTimeU64, endTimeU64] = mappedData;
+        const [kernelType, kernelName] = kernelInfo;
 
         syncData.buffer.unmap();
 
@@ -119,8 +118,8 @@ export class ProgramManager {
             outputsMetadata: outputTensorViews.map(
                 value => ({dims: value.dims, dataType: tensorDataTypeEnumToString(value.dataType)})),
             kernelId,
-            kernelType: kernelInfo[0],
-            kernelName: kernelInfo[1],
+            kernelType,
+            kernelName,
             startTime,
             endTime,
           });
@@ -135,8 +134,8 @@ export class ProgramManager {
             outputShapes += `output[${i}]: [${value.dims}] | ${tensorDataTypeEnumToString(value.dataType)}, `;
           });
           // eslint-disable-next-line no-console
-          console.log(`[profiling] kernel "${kernelId}|${kernelName}" ${inputShapes}${outputShapes}execution time: ${
-              endTime - startTime} ns`);
+          console.log(`[profiling] kernel "${kernelId}|[${kernelType}] ${kernelName}" ${inputShapes}${
+              outputShapes}execution time: ${endTime - startTime} ns`);
         }
       });
     }