async function convertPprofToMarkdown()

in middleware/utils/pprofConverter.js [12:31]


async function convertPprofToMarkdown(profilePath) {
  try {
    // Run pprof command to get text output
    const cmd = `go tool pprof -text ${profilePath}`;
    const { stdout, stderr } = await execAsync(cmd);
    
    if (stderr && !stderr.includes('Main binary filename not available')) {
      console.error('pprof warning:', stderr);
    }
    
    // Parse pprof text output
    const data = parsePprofText(stdout);
    
    // Convert to markdown
    return toMarkdown(data);
  } catch (error) {
    console.error(`Error converting profile: ${error.message}`);
    throw new Error(`Failed to convert profile: ${error.message}`);
  }
}