Home / Function/ stopProfiler() — vite Function Reference

stopProfiler() — vite Function Reference

Architecture documentation for the stopProfiler() function in cli.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  1bdc9ede_9ce1_a42f_ca87_7c569f4c8f2f["stopProfiler()"]
  a4f486ae_83b9_5db5_eb04_81cee52d16a0["cli.ts"]
  1bdc9ede_9ce1_a42f_ca87_7c569f4c8f2f -->|defined in| a4f486ae_83b9_5db5_eb04_81cee52d16a0
  style 1bdc9ede_9ce1_a42f_ca87_7c569f4c8f2f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/cli.ts lines 67–91

export const stopProfiler = (
  log: (message: string) => void,
): void | Promise<void> => {
  if (!profileSession) return
  return new Promise((res, rej) => {
    profileSession!.post('Profiler.stop', (err: any, { profile }: any) => {
      // Write profile to disk, upload, etc.
      if (!err) {
        const outPath = path.resolve(
          `./vite-profile-${profileCount++}.cpuprofile`,
        )
        fs.writeFileSync(outPath, JSON.stringify(profile))
        log(
          colors.yellow(
            `CPU profile written to ${colors.white(colors.dim(outPath))}`,
          ),
        )
        profileSession = undefined
        res()
      } else {
        rej(err)
      }
    })
  })
}

Domain

Subdomains

Frequently Asked Questions

What does stopProfiler() do?
stopProfiler() is a function in the vite codebase, defined in packages/vite/src/node/cli.ts.
Where is stopProfiler() defined?
stopProfiler() is defined in packages/vite/src/node/cli.ts at line 67.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free