Skip to content

othmanAbdelaziz2001/perf-trace-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ PerfTrace Analyzer

A web-based performance trace analyzer that helps you visualize and analyze JSON trace files. Upload your performance traces and get detailed insights into execution patterns, function statistics, and performance metrics.

Features

  • 📤 Upload JSON trace files (up to 200MB)
  • 📊 Analyze performance metrics and function statistics
  • 💡 Generate automated performance insights
  • 🎨 Interactive web interface
  • ⚡ Fast analysis powered by FastAPI

Prerequisites

Before running this project, ensure you have:

  • Python 3.8+ installed
  • pip (Python package manager)
  • macOS, Linux, or Windows with bash or similar shell

Installation & Quick Start

Option 1: Using the Start Script (Recommended for macOS/Linux)

  1. Clone or download this repository
  2. Navigate to the project directory:
    cd perf-trace-analyzer
  3. Run the start script:
    bash start.sh

The script will:

  • Create a Python virtual environment (if not already present)
  • Install all dependencies from requirements.txt
  • Start the FastAPI server
  • Automatically open your browser to http://localhost:8765

To stop the server: Press Ctrl+C in the terminal

Option 2: Manual Setup (Cross-Platform)

  1. Navigate to the project directory:

    cd perf-trace-analyzer
  2. Create a Python virtual environment:

    python3 -m venv .venv
  3. Activate the virtual environment:

    • macOS/Linux:
      source .venv/bin/activate
    • Windows (Command Prompt):
      .venv\Scripts\activate
    • Windows (PowerShell):
      .\.venv\Scripts\Activate.ps1
  4. Install dependencies:

    pip install -r requirements.txt
  5. Start the server:

    uvicorn backend.main:app --host 0.0.0.0 --port 8765 --reload
  6. Open your browser and navigate to:

    http://localhost:8765
    

Usage

  1. Open the web interface at http://localhost:8765
  2. Upload a trace file (JSON format, up to 200MB)
  3. View results:
    • Performance statistics
    • Function call analysis
    • Generated insights and recommendations

API Endpoints

GET /

Returns the main web interface (HTML page)

POST /analyze

Analyzes an uploaded trace file

Request:

  • Content-Type: multipart/form-data
  • File parameter: file (JSON trace file)

Response:

{
  "filename": "trace.json",
  "insights": [...],
  "statistics": {...}
}

Errors:

  • 400: File is not a JSON file
  • 413: File exceeds 200MB limit
  • 500: Parse error during analysis

Project Structure

perf-trace-analyzer/
├── README.md                 # This file
├── requirements.txt          # Python dependencies
├── start.sh                  # Start script for quick launch
├── backend/
│   ├── __init__.py
│   ├── main.py              # FastAPI application
│   └── analyzer.py          # Trace analysis logic
└── frontend/
    ├── index.html           # Main UI
    └── static/              # CSS, JavaScript, assets

Dependencies

  • FastAPI (0.115.6) - Modern Python web framework
  • Uvicorn (0.32.1) - ASGI server
  • python-multipart (0.0.20) - File upload handling

Troubleshooting

Port Already in Use

If port 8765 is already in use, modify the start command:

uvicorn backend.main:app --host 0.0.0.0 --port 8000

Virtual Environment Issues

If the virtual environment doesn't work properly, recreate it:

rm -rf .venv
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Permission Denied on start.sh

Make the script executable:

chmod +x start.sh

Development

The --reload flag in the uvicorn command enables auto-reload during development. Changes to Python files will automatically restart the server.

License

[Add license information if applicable]

Support

For issues or questions, please check the project repository or contact the development team.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors