Compare commits

...

2 Commits

Author SHA1 Message Date
blueloveTH
aa03544d4b Update profiling.md 2025-08-27 18:12:11 +08:00
blueloveTH
8598b44bee update docs 2025-08-27 18:03:21 +08:00
5 changed files with 30 additions and 17 deletions

View File

@ -32,6 +32,8 @@ Please see https://pocketpy.dev for details and try the following resources.
+ [Live Python Demo](https://pocketpy.dev/static/web/): Run Python code in your browser
+ [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
+ [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
+ [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
+ [Flutter Plugin](https://pub.dev/packages/pocketpy): Use pocketpy in Flutter apps
## Supported Platforms

View File

@ -1,24 +1,11 @@
---
icon: dot
title: Debugging
order: 80
---
!!!
This feature is not available in `v2.0` yet.
!!!
## VSCode Extension
You can invoke `breakpoint()` in your python code to start a PDB-like session.
You can install our VSCode extension to debug pocketpy scripts.
The following commands are supported:
+ `h, help`: show this help message
+ `q, quit`: exit the debugger
+ `n, next`: execute next line
+ `s, step`: step into
+ `w, where`: show current stack frame
+ `c, continue`: continue execution
+ `a, args`: show local variables
+ `l, list`: show lines around current line
+ `ll, longlist`: show all lines
+ `p, print <expr>`: evaluate expression
+ `!, execute statement`: execute statement
https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy

View File

@ -0,0 +1,23 @@
---
icon: dot
title: Profiling
order: 79
---
To profile your pocketpy program, you can run `main.exe` with `--profile` flag.
For example, to profile `test/test_math.py`, run
```
main.exe --profile test/test_math.py
```
This will output a JSON report file named `profile_report.json` in the current directory,
which records the time spent for each line. To visualize the report, please install our VSCode extension.
https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy
With pocketpy VSCode extension, press `F1` and type `pocketpy: Load Line Profiler Report`,
select **1. the `profile_report.json` file; 2. the source root of the program**. Then you will see a nice visualization of the profiling result.
![lp](../static/profiler_demo.png)

View File

@ -13,6 +13,7 @@ Developers are able to write Python bindings via C-API or pybind11 compatible in
+ [Live Python Demo](https://pocketpy.dev/static/web/): Run Python code in your browser
+ [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
+ [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
+ [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
+ [Flutter Plugin](https://pub.dev/packages/pocketpy): Use pocketpy in Flutter apps
## What it looks like

BIN
docs/static/profiler_demo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB