Is there a way to track a build time in VSCode and record it to a text file

700 views Asked by At

I need to record the build time of the project to find out the average build time in VSCode. For example, this is how it can be implemented in Xcode https://github.com/timroesner/BuildTimes. I have already tried "preLaunchTask", "postDebugTask" in launch.json, but it's not exactly what I need.

1

There are 1 answers

1
rioV8 On

You can use Compound tasks.

The tasks to perform are:

  1. Record the start
  2. Build
  3. Record the end
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Start Build",
      "type": "shell",
      "command": "BuildTimes -start",
    },
    {
      "label": "End Build",
      "type": "shell",
      "command": "BuildTimes -end",
    },
    {
      "label": "List BuildTime",
      "type": "shell",
      "command": "BuildTimes -list",
    },
    {
      "label": "Build",
      "command": "gulp",
      "args": ["build"],
      "options": {
        "cwd": "${workspaceFolder}/server"
      }
    },
    {
      "label": "Record Build Time",
      "dependsOrder": "sequence",
      "dependsOn": ["Start Build", "Build", "End Build"]
    }
  ]
}

Modify the Build task to what you need.

In your launch.json set the preLaunchTask to Record Build Time