File size: 2,814 Bytes
95a58a1
 
 
 
 
 
 
 
 
 
 
 
 
 
9e075cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
title: Macos Sample File Viewer
emoji: πŸŒ–
colorFrom: blue
colorTo: yellow
sdk: static
pinned: false
license: apache-2.0
app_build_command: npm run build
app_file: dist/index.html
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# πŸ” Backtrace Viewer

A modern web application for viewing and analyzing backtrace files from sampling profilers, built with Svelte.

## Features

- **πŸ“ File Upload**: Load your own backtrace files or use the included sample
- **πŸ” Thread Filtering**: Filter threads by name using exact prefix matching  
- **πŸ‘€ Toggle Views**: Expand/collapse individual threads to focus on what matters
- **πŸ“Š Collapsible Backtraces**: Click on any backtrace line to collapse/expand sections
- **πŸ“± Responsive Design**: Works great on desktop and mobile devices
- **⚑ Fast Performance**: Built with Svelte for optimal performance

## Getting Started

### Prerequisites

- Node.js (version 14 or higher)
- npm or yarn

### Installation

1. Clone or navigate to the project directory:

   ```bash
   cd backtrace-viewer
   ```

2. Install dependencies:

   ```bash
   npm install
   ```

3. Start the development server:

   ```bash
   npm run dev
   ```

4. Open your browser to `http://localhost:5173`

### Building for Production

```bash
npm run build
```

The built files will be in the `dist/` directory.

## Usage

### Loading Files

- The app will automatically load `sample.txt` when you open it
- Click "πŸ“ Load Backtrace File" to upload your own backtrace files
- Supported format: Text files from sampling profilers (like macOS `sample` command)

### Filtering Threads

- Use the filter input to find threads by name
- Only shows threads whose names start with your filter text (case-insensitive)
- Thread names are extracted from the part after the `:` in thread headers

### Viewing Backtraces

- Click on any thread header to expand/collapse its backtrace
- Click on individual backtrace lines to collapse/expand sections
- Indentation shows the call hierarchy
- Sample counts and function names are highlighted for easy reading

### File Format Support

The viewer supports backtrace files with this format:

```
6963 Thread_10032126: hf-xet-0
+ 6963 thread_start  (in libsystem_pthread.dylib) + 8  [0x19e40ab80]
+   6963 _pthread_start  (in libsystem_pthread.dylib) + 136  [0x19e40fc0c]
+     6963 pythread_wrapper  (in Python) + 48  [0x104da7cd0]
...
```

Where:

- Thread headers: `{count} Thread_{id}: {name}`
- Thread names: Optional part after `:`
- Backtrace lines: Indented with `+`, `!`, `:`, `|` characters
- Sample counts, function names, and addresses are automatically highlighted

## Contributing

Feel free to open issues or submit pull requests to improve the viewer!

## License

MIT License