An open API service indexing awesome lists of open source software.

https://github.com/nodesource/cpu-summarizer-for-datasets

Summarize cpu profiles
https://github.com/nodesource/cpu-summarizer-for-datasets

Last synced: 7 months ago
JSON representation

Summarize cpu profiles

Awesome Lists containing this project

README

          

# CPU Profile Summarizer

This tool is designed to summarize CPU profiling data for use in generating dataset prompts, providing insights into function execution times and their impact on CPU usage.

## Prerequisites

Before you can use the CPU Profile Summarizer, ensure you have Node.js installed on your system. You can download and install Node.js from [https://nodejs.org/](https://nodejs.org/).

## Installation

No installation is required. Simply clone or download the repository containing the tool to your local machine.

## Usage

To use the CPU Profile Summarizer, follow these steps:

1. Open a terminal or command prompt.
2. Navigate to the directory containing the `index.js` file of the CPU Profile Summarizer.
3. Run the tool using Node.js, passing the path to the CPU profile JSON file as an argument:

```bash
node index.js
```

Replace with the actual path to your CPU profile JSON file.

For example:

```bash
node index.js profiles/myAppProfile.cpuprofile
```

The tool will process the CPU profile and generate a summary file in the summaries directory, located in the same directory as index.js. The summary file will be named after the original profile file, with a .summary.jsonl extension.

## Output

The tool will return the prompt with the data you will only have to add your question and your answer

```jsonl
{"messages":[{"role":"user","content":"Given the following CPU profile data: answer the following question: < your question>"},{"role":"assistant","content":""}]}
```

The summary contains the following information:

topSelfTimeFunctions: Functions with the highest self execution times.
topTotalTimeFunctions: Functions with the highest total execution times.
startTime: The start time of the profiling session, in seconds.
endTime: The end time of the profiling session, in seconds.

Each function in the topSelfTimeFunctions and topTotalTimeFunctions lists includes:

functionName: The name of the function.
totalTime: The total execution time of the function, in seconds.
hitCount: The number of times the function was executed.
selfTime: The self execution time of the function, in seconds.
url: The URL of the script containing the function.
selfTimePercentage: The percentage of the highest self time relative to the total profile duration.
totalTimePercentage: The percentage of the highest total time relative to the total profile duration.