Skip to content

Commit a213b45

Browse files
fulloclaude
andcommitted
v1.0: HTML dashboard SVG charts, author/license headers, final polish
HTML Dashboard (HtmlReporter): - SVG timeline chart: inline polyline of last 50 SCI values with area fill, grid lines, Y-axis min/max labels, X-axis timestamps - Per-script SVG sparklines: inline 120x24 polyline per script group - Last vs Previous comparison column with percentage delta and color coding (green ▼ improved, red ▲ worse, gray ═ stable) - All SVG generated server-side in PHP — zero external JS dependencies Author/License/Version headers: - Added @author fullo <https://github.com/fullo>, @license MIT, @Version 1.0 to all 17 PHP source files Documentation: - Updated doc/reporters.md with SVG timeline, sparkline, and last-vs-prev feature descriptions - README test count updated to 119 tests, 569 assertions Phar rebuilt (79.5 KB, 18 files). 119 tests, 569 assertions, PHPStan clean, 97% line coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6afb644 commit a213b45

21 files changed

Lines changed: 363 additions & 7 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Full documentation is in the [`doc/`](doc/) directory:
108108

109109
```bash
110110
composer install
111-
composer test # PHPUnit (90 tests, 517 assertions)
111+
composer test # PHPUnit (119 tests, 569 assertions)
112112
composer analyse # PHPStan static analysis
113113
composer cs-fix # PSR-12 coding style
114114
```

bin/sci-profiler.phar

7.69 KB
Binary file not shown.

doc/reporters.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ Best for: visual overview, team dashboards, periodic review.
113113
### What it shows
114114

115115
- **Summary cards**: total requests, average SCI, total emissions, average response time
116-
- **Detail table**: timestamp, method, URI, response time, SCI score, peak memory for the last 200 requests
116+
- **SVG timeline chart**: inline SVG polyline of SCI values over the last 50 entries, with area fill, grid lines, and axis labels — no JavaScript required
117+
- **Per-script summary table**: grouped by script filename, with inline SVG sparkline, "last vs previous" comparison (with percentage delta), and first-half/second-half trend indicator
118+
- **Measurement parameters**: device power (E), grid carbon intensity (I), embodied carbon (M), device lifetime
119+
- **Detail table**: timestamp, method, URI (with script filename), response time, SCI score with delta marks (▲/▼), status badges (200/301/500), peak memory — last 200 requests
117120

118121
### Setup
119122

src/Collector/CollectorInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
*
1010
* Each collector gathers a specific type of metric
1111
* during the request lifecycle.
12+
*
13+
* @author fullo <https://github.com/fullo>
14+
* @license MIT
15+
* @version 1.0
1216
*/
1317
interface CollectorInterface
1418
{

src/Collector/MemoryCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
* Collects memory usage metrics.
99
*
1010
* Tracks initial memory, peak memory, and delta during the request.
11+
*
12+
* @author fullo <https://github.com/fullo>
13+
* @license MIT
14+
* @version 1.0
1115
*/
1216
final class MemoryCollector implements CollectorInterface
1317
{

src/Collector/RequestCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
*
1010
* Captures method, URI, response code, and I/O sizes
1111
* without modifying the application.
12+
*
13+
* @author fullo <https://github.com/fullo>
14+
* @license MIT
15+
* @version 1.0
1216
*/
1317
final class RequestCollector implements CollectorInterface
1418
{

src/Collector/TimeCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
* Uses getrusage() for user/system CPU time on supported platforms.
1515
*
1616
* @see https://www.php-fig.org/psr/psr-20/
17+
*
18+
* @author fullo <https://github.com/fullo>
19+
* @license MIT
20+
* @version 1.0
1721
*/
1822
final class TimeCollector implements CollectorInterface
1923
{

src/Config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
*
1010
* Default values align with the Green Software Foundation methodology.
1111
* Override via config file or environment variables prefixed with SCI_PROFILER_.
12+
*
13+
* @author fullo <https://github.com/fullo>
14+
* @license MIT
15+
* @version 1.0
1216
*/
1317
final class Config
1418
{

src/GridCarbonData.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
* Data vintage: 2024 (most countries), CC BY 4.0 license.
1818
*
1919
* @see https://ember-energy.org/
20+
*
21+
* @author fullo <https://github.com/fullo>
22+
* @license MIT
23+
* @version 1.0
2024
*/
2125
final class GridCarbonData
2226
{

src/ProfileResult.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
/**
88
* Immutable value object containing all profiling results for a single request.
9+
*
10+
* @author fullo <https://github.com/fullo>
11+
* @license MIT
12+
* @version 1.0
913
*/
1014
final class ProfileResult
1115
{

0 commit comments

Comments
 (0)