Skip to content

Commit c8ccab8

Browse files
committed
Improve documentation
1 parent 3fadc2c commit c8ccab8

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

docs/1.0/building-blocks.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It is the **base construct** used to measure resource consumption across differe
1616

1717
`Snapshots` are **read-only** after creation.
1818

19-
### Create a Snapshot
19+
### Take a Snapshot
2020

2121
You can create a snapshot using the `now()` static method:
2222

@@ -45,8 +45,6 @@ $snapshot->cpuSystemTime;
4545
$snapshot->hrtime;
4646
```
4747

48-
### Labels
49-
5048
You can optionally attach a label to a `Snapshot`. If you do not assign a label to the snapshot, one will be
5149
automatically assigned to it. Labels can include lowercase letters, digits, dots, underscores,
5250
and hyphens—but cannot start or end with a symbol, nor have consecutive symbols.
@@ -96,14 +94,13 @@ $span->range; // represents the file range between the start and end (the locat
9694
$span->metrics // the calculated metrics computed from the 2 snapshots.
9795
```
9896

99-
### Label
10097

10198
The `label` property is similar to the snapshot identity and uses the same requirements. But, in contrast to
10299
the `Snapshot`, **the label value is mandatory**.
103100

104-
### Metrics
101+
## Metrics
105102

106-
The `metrics` property is a `Metrics` value object which exposes the following readonly metric:
103+
The `Span::metrics` property is a `Metrics` value object which exposes the following readonly metric:
107104

108105
- `executionTime`
109106
- `cpuTime`
@@ -129,9 +126,9 @@ $span->metrics->realPeakMemoryUsage; // in bytes
129126
$span->metrics->realPeakMemoryUsageGrowth; // in bytes
130127
```
131128

132-
### Call Location Range
129+
## Call Location Range
133130

134-
The `range` property is a `CallRange` value object which allows comparing the call location between
131+
The `Spab::range` property is a `CallRange` value object which allows comparing the call location between
135132
the starting and the ending snapshots.
136133

137134
```php
@@ -166,7 +163,7 @@ $span->range->isDifferentLine(); //returns false if the both locations are the s
166163
The `Report` value object represents a **profiling or metrics summary** of a process, function or operation. It encapsulates **row-level statistics**
167164
for each metric type (CPU time, memory usage, etc.) and provides **column-oriented access** to aggregated metrics.
168165

169-
### Accessing Row-Level Statistics
166+
### Row-Level Statistics
170167

171168
You can retrieve a single row of metrics ( a `Statistics` object) by metric type:
172169

@@ -177,7 +174,7 @@ $report = stack_report(fn () => true, iterations: 50);
177174
$cpuRow = $report->row(MetricType::CpuTime); //returns a Statistics object
178175
```
179176

180-
### Accessing Column-Level Aggregated Metrics
177+
### Column-Level Metrics
181178

182179
You can also retrieve aggregated metrics (like min, max, average) **across all types** for a given aggregation:
183180

@@ -230,7 +227,7 @@ All the value objects can be
230227
- JSON-encoded via `json_encode` (implementing the `JsonSerializable` interface)
231228
- Returned in a **human-readable** format via `toHuman()`. (except for the `CallLocation` and the `CallRange` objects.
232229

233-
### Full human-readable export
230+
### Human-readable export
234231

235232
The human-readable export automatically converts **nanoseconds** and **bytes** into more human-friendly
236233
formats depending on the recorded values.

docs/1.0/command.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ php vendor/bin/stackwatch --path=PATH [options]
211211
```
212212
Apart from the `path` argument, all the other command line options **are optional**.
213213

214-
### Command Line Options
214+
## Command Line Options
215215

216-
#### Configuration
216+
### Configuration
217217

218218
**`-p, --path=PATH`**
219219
Path to scan for PHP files to profile. **Required.** The path can be a file or a directory.
@@ -228,7 +228,7 @@ Display the help message.
228228
**`-V, --version`**
229229
Display the version and exit.
230230

231-
#### Output
231+
### Output
232232

233233
**`-f, --format=FORMAT`**
234234
Output format. Can be either `'text'` or `'json'`. Default is `'text'`. Use `'text'` for human-readable
@@ -246,7 +246,7 @@ Pretty-print the JSON/NDJSON output. **JSON only.**
246246
**`--no-progress`**
247247
Hides the progress bar
248248

249-
#### Selection
249+
### Selection
250250

251251
**`-d, --depth=DEPTH`**
252252
Recursion depth. `0` means scan only the current directory. By default, recursion is unlimited.
@@ -266,7 +266,7 @@ Only run the profiles for methods with the listed visibilities. The visibility i
266266
And can only take `private`, `protected` or `public` values. By default, all methods are run
267267
regardless of their visibility status.
268268

269-
#### Execution
269+
### Execution
270270

271271
**`-x, --isolation`**
272272
Profile each file in isolation.

docs/1.0/timeline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ The `Timeline` class provides a `filter()` method to extract a subset of its `Sn
209209
- The callback must return `true` for a Snapshot to be included in the results.
210210
- The method returns a list of matching Snapshots.
211211

212-
### Example
212+
Here's a simple filtering example:
213213

214214
```php
215215
use Bakame\Stackwatch\MemoryUnit;

0 commit comments

Comments
 (0)