From cbc84e201116fa4f14b82eb4ba5ddbe4eaba0157 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:36:12 +0000 Subject: [PATCH] measure basic checkpoint perf --- apps/coordinator/src/index.ts | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/apps/coordinator/src/index.ts b/apps/coordinator/src/index.ts index 91d670889..2bcb86163 100644 --- a/apps/coordinator/src/index.ts +++ b/apps/coordinator/src/index.ts @@ -41,13 +41,10 @@ type CheckpointAndPushOptions = { deploymentVersion: string; }; -type CheckpointAndPushReturn = Promise< - | { - location: string; - docker: boolean; - } - | undefined ->; +type CheckpointData = { + location: string; + docker: boolean; +}; class Checkpointer { #initialized = false; @@ -134,7 +131,26 @@ class Checkpointer { } } - async checkpointAndPush(opts: CheckpointAndPushOptions): CheckpointAndPushReturn { + async checkpointAndPush(opts: CheckpointAndPushOptions): Promise { + const start = performance.now(); + logger.log(`checkpointAndPush() start`, { start, opts }); + + const result = await this.#checkpointAndPush(opts); + + const end = performance.now(); + + logger.log(`checkpointAndPush() end`, { + start, + end, + diff: end - start, + opts, + success: !!result, + }); + + return result; + } + + async #checkpointAndPush(opts: CheckpointAndPushOptions): Promise { await this.initialize(); if (!this.#dockerMode && !this.#canCheckpoint) {