Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions docs/src/content/docs/guides/dev/debugging.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: Debugging
description: Investigating issues and profiling app performance
sidebar:
order: 3
---

import { Steps, Tabs, TabItem } from "@astrojs/starlight/components";


We will demonstrate use of various tools to provide how to inspect and investigate possible performance issues within your Wails app using
- [`runtime/trace`](https://pkg.go.dev/runtime/trace) to create performance graphs and inspect them in a browser

Comment on lines +11 to +13
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Tighten the intro sentence for clarity.

Line 11 reads awkwardly (“provide how to inspect”). A small wording fix will improve readability.

✏️ Proposed wording tweak
-We will demonstrate use of various tools to provide how to inspect and investigate possible performance issues within your Wails app using
+This guide demonstrates tools you can use to inspect and investigate potential performance issues in your Wails app:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
We will demonstrate use of various tools to provide how to inspect and investigate possible performance issues within your Wails app using
- [`runtime/trace`](https://pkg.go.dev/runtime/trace) to create performance graphs and inspect them in a browser
This guide demonstrates tools you can use to inspect and investigate potential performance issues in your Wails app:
- [`runtime/trace`](https://pkg.go.dev/runtime/trace) to create performance graphs and inspect them in a browser
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/src/content/docs/guides/dev/debugging.mdx` around lines 11 - 13, Revise
the introductory sentence so it reads clearly and concisely; replace the awkward
"We will demonstrate use of various tools to provide how to inspect and
investigate possible performance issues within your Wails app using" with a
tightened version such as "We will demonstrate various tools to inspect and
investigate performance issues in your Wails app, including:", then keep the
existing bullet for runtime/trace to follow that lead-in.

## Creating performance traces

<Steps>

1. **Prepare your app for Tracing**

Close to your program entrypoint, ensure code along the following lines exists

```go
// Create the file to store our trace data within
traceFile, err := os.Create("trace.out")
if err != nil {
log.Fatalf("trace.out could not be created: %v", err)
}

// Start the trace
if err := trace.Start(traceFile); err != nil {
_ = traceFile.Close()
log.Fatalf("trace.start could not start: %v", err)
}

// Trace cleanup on exit. Alternatively,
defer func() {
trace.Stop()
_ = traceFile.Close()
}()

...Start your wails app here...
```

Output will be saved to `trace.out` within your working path with metrics covering the complete runtime of your app. The default trace is quite raw; you are well advised to do further reading on trace to add more contextual information and limit what you actually record. For example: `WithRegion, NewTask, Log`

2. **Run your app to create the trace**

With your app running, a continuous trace will be produced up to the point of exit so go ahead and perform some actions in your app and exit when complete

3. **Install Visualisation helpers**

Some views need [Graphviz](https://graphviz.org/). You can verify it is installed by running `dot -V`

```bash
# macOS
brew install graphviz

# Ubuntu/Debian
sudo apt-get install graphviz

# Arch
sudo pacman -S graphviz
```

4. **Visualize your trace**

With your trace data available, we can start up the web interface

```bash
go tool trace trace.out
```

This should open up your default browser (recommended to use Chrome based) with the trace event viewer home page.

For first time users, the `Syscall profile` screen is probably the most useful. This provides a breakdown of exactly what the program is doing along with timings
Comment on lines +73 to +75
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix hyphenation in user-facing prose.

Use compound-word hyphenation on Line 73 and Line 75 for polished docs copy (Chrome-based, first-time).

✏️ Proposed copy edit
-This should open up your default browser (recommended to use Chrome based) with the trace event viewer home page.
+This should open your default browser (a Chrome-based browser is recommended) with the trace event viewer home page.

-For first time users, the `Syscall profile` screen is probably the most useful.
+For first-time users, the `Syscall profile` screen is probably the most useful.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
This should open up your default browser (recommended to use Chrome based) with the trace event viewer home page.
For first time users, the `Syscall profile` screen is probably the most useful. This provides a breakdown of exactly what the program is doing along with timings
This should open your default browser (a Chrome-based browser is recommended) with the trace event viewer home page.
For first-time users, the `Syscall profile` screen is probably the most useful. This provides a breakdown of exactly what the program is doing along with timings
🧰 Tools
🪛 LanguageTool

[grammar] ~73-~73: Use a hyphen to join words.
Context: ...fault browser (recommended to use Chrome based) with the trace event viewer home ...

(QB_NEW_EN_HYPHEN)


[grammar] ~75-~75: Use a hyphen to join words.
Context: ...e event viewer home page. For first time users, the Syscall profile screen...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/src/content/docs/guides/dev/debugging.mdx` around lines 73 - 75, Update
the prose to use compound-word hyphenation: replace "Chrome based" with
"Chrome-based" and "first time users" with "first-time users" in the sentence
that currently reads "This should open up your default browser (recommended to
use Chrome based)..." and the sentence starting "For first time users, the
`Syscall profile`..."; keep the rest of the text unchanged.

</Steps>
2 changes: 1 addition & 1 deletion v3/UNRELEASED_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ After processing, the content will be moved to the main changelog and this file
-->

## Added
<!-- New features, capabilities, or enhancements -->
- Add debugging page and working with `runtime/trace`

## Changed
<!-- Changes in existing functionality -->
Expand Down
Loading