Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a50d6f

Browse files
test(profiling) add tests for timeline (DataDog#2192)
1 parent 253525d commit 7a50d6f

4 files changed

Lines changed: 73 additions & 0 deletions

File tree

.github/workflows/prof_correctness.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/time/test.pprof php -d extension=$PWD/target/release/libdatadog_php_profiling.so profiling/tests/correctness/time.php
5959
mkdir profiling/tests/correctness/strange_frames/
6060
DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/strange_frames/test.pprof php -d extension=$PWD/target/release/libdatadog_php_profiling.so profiling/tests/correctness/strange_frames.php
61+
mkdir profiling/tests/correctness/timeline/
62+
DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/timeline/test.pprof DD_PROFILING_EXPERIMENTAL_TIMELINE_ENABLED=1 php -d extension=$PWD/target/release/libdatadog_php_profiling.so profiling/tests/correctness/timeline.php
6163
6264
- name: Check profiler correctness for allocations
6365
uses: Datadog/prof-correctness/analyze@main
@@ -76,3 +78,9 @@ jobs:
7678
with:
7779
expected_json: profiling/tests/correctness/strange_frames.json
7880
pprof_path: profiling/tests/correctness/strange_frames/
81+
82+
- name: Check profiler correctness for timeline
83+
uses: Datadog/prof-correctness/analyze@main
84+
with:
85+
expected_json: profiling/tests/correctness/timeline.json
86+
pprof_path: profiling/tests/correctness/timeline/
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"test_name": "php_timeline",
3+
"stacks": [
4+
{
5+
"profile-type": "timeline",
6+
"stack-content": [
7+
{
8+
"regular_expression": "^\\[gc\\]$",
9+
"percent": 100,
10+
"error_margin": 100,
11+
"labels": [
12+
{
13+
"key": "gc reason",
14+
"values": [
15+
"induced"
16+
]
17+
},
18+
{
19+
"key": "event",
20+
"values": [
21+
"gc"
22+
]
23+
}
24+
]
25+
},
26+
{
27+
"regular_expression": "^\\[require\\]$",
28+
"percent": 100,
29+
"error_margin": 100,
30+
"labels": [
31+
{
32+
"key": "event",
33+
"values": [
34+
"compilation"
35+
]
36+
}
37+
]
38+
},
39+
{
40+
"regular_expression": "^\\[include\\]$",
41+
"percent": 100,
42+
"error_margin": 100,
43+
"labels": [
44+
{
45+
"key": "event",
46+
"values": [
47+
"compilation"
48+
]
49+
}
50+
]
51+
}
52+
]
53+
}
54+
]
55+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
function foobar () {
4+
gc_collect_cycles();
5+
}
6+
7+
include(__DIR__.'/timeline_call.php');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
foobar();

0 commit comments

Comments
 (0)