Skip to main content
Branch: Release Candidate

IProfile

Follows Chrome DevTools cpuprofile format. See Chrome DevTools protocol docs for more details.

In order to analyze resulting Profile - serialize this class as JSON and put to a .cpuprofile file. It will be available to use in DevTools on “Performance” tab, or in Visual Studio Code.

Example

// server
alt.onClient("saveProfile", (player, name, content) => {
fs.writeFileSync("./" + name + ".cpuprofile", content);
});

// client
alt.Profile.startProfiling("test");
// do some stuff
const profile = alt.Profile.stopProfiling("test");
const content = JSON.stringify(profile);
alt.emitServer("saveProfile", "test", content);

Index

Properties

readonlyendTime

endTime: number

Profiling end timestamp in microseconds.

readonlynodes

nodes: readonly IProfileNode[]

The list of profile nodes. First item is the root node.

readonlysamples

samples: readonly number[]

Ids of samples top nodes.

readonlystartTime

startTime: number

Profiling start timestamp in microseconds.

readonlytimeDeltas

timeDeltas: readonly number[]

Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime.