Skip to content

Commit 813b368

Browse files
Update README
1 parent b3fb940 commit 813b368

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1+
# Introduction
2+
This repo provides a script which construct a visual call graph representation of a set of call stacks. It's currently optimized for SQL Server call stacks symbolized by [SQLCallStackResolver](https://aka.ms/SQLStack). Users can use these generated call graphs to visually understand the flow in the SQL Server functions being executed in their scenario. Call graphs can be especially useful to diagnose memory leaks. An example of such a visualized call graph for a memory leak case is shown below. The intuition behind using these call graphs is to follow the thicker connections in the graph - thick lines indicate high rate of calls of those functions. If there are equal or comparable calls to new() and free() - conceptually speaking - then you may conclude there's no leak; in this specific case, there's hardly any calls to free(); indicating a potential memory leak.
3+
4+
<img src="images/call-graph-leak-sample.png" alt="Sample call graph for a memory leak scenario" style="width: 1280px">
5+
6+
# Usage
7+
First, ensure you have installed the pre-requisites. Then, just run export-callgraph-graphviz.py with the full path to the file containing the call stacks to be visualized.
8+
9+
```
10+
cd C:\SCSR-Graphs
11+
python .\src\export-callgraph-graphviz.py C:\temp\generate-series-leak-cu19.txt
12+
```
13+
The script will output 2 files - a DOT file, which is in standard GraphViz format; and a SVG file which can be viewed in your browser, or in more specialized tools like [InkScape](https://inkscape.org). Here is a sample screenshot of the output files:
14+
15+
<img src="images/output-files.png" alt="Output files" style="width: 400px">
16+
117
# Installation on Windows
218

319
* Clone this repo to `C:\SCSR-Graphs`
420

521
* Install [Python 3.13.5 for Windows](https://www.python.org/ftp/python/3.13.5/python-3.13.5-amd64.exe). Ensure the "Add Python to environmental variables" checkbox is selected.
622

7-
![Python installation screen](images/python-installer.png)
23+
<img src="images/python-installer.png" alt="Python installation screen" style="width: 400px">
824

925
* Download [GraphViz for Windows](https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/13.0.1/windows_10_cmake_Release_Graphviz-13.0.1-win64.zip) and extract it to a folder like `C:\GraphViz`.
1026

11-
![Contents of GraphViz folder after extraction](images/graphviz-folder.png)
27+
<img src="images/graphviz-folder.png" alt="Contents of GraphViz folder after extraction" style="width: 300px">
1228

1329
* Add the GraphViz `bin` folder to the system PATH variable.
1430

@@ -18,7 +34,7 @@
1834

1935
* Install [Visual C++ Build Tools](https://aka.ms/vs/17/release/vs_BuildTools.exe) and restart Windows if prompted to, at the end of the installation.
2036

21-
![Visual C++ Build Tools installation screen](images/vcbuildtools.png)
37+
<img src="images/vcbuildtools.png" alt="Visual C++ Build Tools installation screen" style="width: 600px">
2238

2339
* Install PyGraphViz using pip by running the following command within a PowerShell window:
2440

@@ -68,13 +84,3 @@ Successfully installed networkx-3.5 pydot-4.0.1 pyparsing-3.2.3
6884

6985
At this stage, you are ready to use the Python script!
7086

71-
# Running the Python script
72-
Just run export-callgraph-graphviz.py with the full path to the file containing the call stacks to be visualized.
73-
74-
```
75-
cd C:\SCSR-Graphs
76-
python .\src\export-callgraph-graphviz.py C:\temp\generate-series-leak-cu19.txt
77-
```
78-
The script will output 2 files - a DOT file, which is in standard GraphViz format; and a SVG file which can be viewed in your browser, or in more specialized tools like [InkScape](https://inkscape.org). Here is a sample screenshot of the output files:
79-
80-
![Output files](images/output-files.png)

images/call-graph-leak-sample.png

279 KB
Loading

0 commit comments

Comments
 (0)