@@ -9,7 +9,7 @@ The package can help with exporting its metrics using different mechanisms.
99
1010## JSON
1111
12- Both the ` SpanAggregator ` and ` Timeline ` classes support JSON export via PHP's ` json_encode ` function.
12+ Both the ` Profiler ` and ` Timeline ` classes support JSON export via PHP's ` json_encode ` function.
1313This allows you to serialize profiling data for inspection, storage, or transmission.
1414
1515Calling ` json_encode($profiler) ` will produce a JSON object containing:
@@ -45,9 +45,9 @@ streams, string path and `SplFileInfo` objects.
4545
4646``` php
4747use Bakame\Stackwatch\JsonExporter;
48- use Bakame\Stackwatch\Profiler ;
48+ use Bakame\Stackwatch\Stack ;
4949
50- $report = Profiler ::report($service->calculateHeavyStuff(...), 500);
50+ $report = Stack ::report($service->calculateHeavyStuff(...), 500);
5151$exporter = new JsonExporter('path/to/store/the/profile.json', JSON_PRETTY_PRINT|JSON_BIGINT_AS_STRING);
5252$exporter->exportReport($report);
5353```
@@ -60,10 +60,10 @@ and only the last export will be stored. To get the data appended provide an alr
6060
6161## CLI
6262
63- You can display the ` SpanAggregator ` or the ` Timeline ` recorded data recorded using the ` StatsExporter ` class.
63+ You can display the ` Profiler ` or the ` Timeline ` recorded data recorded using the ` StatsExporter ` class.
6464
6565``` php
66- use Bakame\Stackwatch\SpanAggregator ;
66+ use Bakame\Stackwatch\Profiler ;
6767use Bakame\Stackwatch\ViewExporter;
6868
6969$callback = function (int ...$args): int {
@@ -72,13 +72,13 @@ $callback = function (int ...$args): int {
7272 return array_sum($args);
7373};
7474
75- $aggregator = new SpanAggregator ($callback);
75+ $aggregator = new Profiler ($callback);
7676$aggregator->profile('first_run', 1, 2);
7777$aggregator->profile('last_run', 1, 2);
7878$aggregator->run(1, 2);
7979
8080$exporter = new ViewExporter();
81- $exporter->exportSpanAggregator ($aggregator);
81+ $exporter->exportProfiler ($aggregator);
8282```
8383the following table will be outputted in your terminal.
8484
0 commit comments