Skip to content

Latest commit

 

History

History
272 lines (200 loc) · 12.7 KB

xhprof-collector.md

File metadata and controls

272 lines (200 loc) · 12.7 KB

PHPerf XHPROF Aggregator

Version: cli-mode

Schema.

Table Of Contents

Operations

GET /profile

List Profiles

Response

Status Content Type Body Type Description
200 application/json XhProfiles OK

POST /profile

Collect Profile

Collects XHPROF-compatible PHP profile.

Parameters

Name In Type
body body XhCollectProfileInput

Response

Status Content Type Body Type Description
202 Accepted
409 application/json XhRestErrResponse Conflict

GET /profile.dot

Dot Graph

Parameters

Name In Type Description Examples
rootSymbol query String MyNamespace\MyClass::do
graphLimit query Number Maximum number of nodes (symbols) in graph.
graphPriority query 'wt',
'cpu',
'io'
Graph resource determines nodes selection to expose strongest contributors.
aggregate query XhAggregatorGroup

Response

Status Content Type Body Type Description
200 text/vnd.graphviz OK
404 application/json XhRestErrResponse Not Found

GET /profile/find-symbol

Find Symbol

Parameters

Name In Type Description
aggregate query XhAggregatorGroup
match query String Substring to match in symbol.
limit query Number Limit number of results.

Response

Status Content Type Body Type Description
200 application/json XhSearchOutput OK
404 application/json XhRestErrResponse Not Found

GET /profile/symbol

Symbol Stat

Parameters

Name In Type Examples
aggregate query XhAggregatorGroup
symbol query String MyNamespace\MyClass::do

Response

Status Content Type Body Type Description
200 application/json XhSymbolStatOutput OK
404 application/json XhRestErrResponse Not Found

GET /top-traces

Top Traces

Get traces that occupy most of resource.

Parameters

Name In Type Description Examples
rootSymbol query String MyNamespace\MyClass::do
aggregate query XhAggregatorGroup
resource query 'wt',
'cpu',
'io'
Graph resource determines nodes selection to expose strongest contributors.
limit query Number

Response

Status Content Type Body Type Description
200 application/json Array<XhTraceInfo> OK
404 application/json XhRestErrResponse Not Found

POST /upload/profile

Upload Profile

Collects XHPROF-compatible PHP profile from uploaded JSON/PHP-Serialized file.

Parameters

Name In Type
profile formData null, String, Format: binary
sample formData Number

Response

Status Content Type Body Type Description
202 Accepted
409 application/json XhRestErrResponse Conflict

POST /upload/profiles

Upload Profiles

Collects XHPROF-compatible PHP profiles from uploaded JSON/PHP-Serialized files.

Parameters

Name In Type Description
profiles formData Array<null, String, Format: binary>, null Files with profile JSON data.

Response

Status Content Type Body Type Description
202 Accepted
409 application/json XhRestErrResponse Conflict

Types

XhAggregatorGroup

Property Type Description
end Number Interval end UTC unix timestamp.
id String Profile ID.
labels Map<String,String>, null
start Number Interval start UTC unix timestamp.

XhProfileInfo

Property Type
addr XhAggregatorGroup
cpu String
edges Number
io String
peakMem String
profiles Number
wt String

XhProfiles

Property Type
activeAggregates Array<XhProfileInfo>, null
recent Array<XhProfileInfo>, null

XhProfileValue

Property Type Description
as Number Aggregation size, count of parent profiles.
cpu Number CPU time in microseconds.
ct Number Count of calls.
io Number IO time in microseconds.
mem.aa Number The amount of allocated memory.
mem.na Number The sum of the number of all allocations in this function.
mem.nf Number The sum of the number of all frees in this function.
mu Number Memory usage in bytes.
pmu Number Peak memory usage in bytes.
wt Number Wall time in microseconds.

XhCollectProfileInput

Property Type Description
id (required) String Random string created by client to identify profile.
labels Map<String,String>, null
meta Map<String,*>, null Additional context.
profile Map<String,XhProfileValue>, null

XhRestErrResponse

Property Type Description
code Number Application-specific error code.
context Map<String,*> Application context.
error String Error message.
status String Status text.

XhSearchOutput

Property Type
symbols Array<String>, null

XhRenderValueStat

Property Type
as String
cpu String
cpuf String
ct String
ctf String
io String
iof String
ma String
mac String
mf String
mu String
pmu String
wt String
wtf String

XhSymbolStatOutput

Property Type Description
callees Map<String,XhRenderValueStat> Callees stat.
callers Map<String,XhRenderValueStat> Callers stat.
exclusive XhRenderValueStat
inclusive XhRenderValueStat

XhTraceInfo

Property Type
hash String
stat XhRenderValueStat
symbol String
trace Array<String>, null