增加cpu调试
This commit is contained in:
parent
7676fc3142
commit
c2b1a6cb0b
4050
package-lock.json
generated
4050
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,7 @@
|
||||
"axios": "^1.4.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"express": "^4.18.2",
|
||||
"inspector-api": "^1.4.8",
|
||||
"ioredis": "^5.3.2",
|
||||
"json5": "^2.2.3",
|
||||
"mathjs": "^11.4.0",
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { Reqheapdump, Resheapdump } from "../../monopoly/protocols/games/Ptlheapdump";
|
||||
var heapdump = require('heapdump');
|
||||
import Inspector from 'inspector-api'
|
||||
const inspector = new Inspector({ storage: { type: 'fs' } })
|
||||
|
||||
export default async function (call: ApiCall<Reqheapdump, Resheapdump>) {
|
||||
|
||||
@ -20,4 +22,24 @@ export default async function (call: ApiCall<Reqheapdump, Resheapdump>) {
|
||||
data:"gc..."
|
||||
})
|
||||
}
|
||||
|
||||
if(call.req.act == "cpustart"){
|
||||
await inspector.profiler.enable()
|
||||
await inspector.profiler.start()
|
||||
console.log('CPU profile has been start')
|
||||
call.succ({
|
||||
code:200,
|
||||
data:"profiler.start"
|
||||
})
|
||||
}
|
||||
|
||||
if(call.req.act == "cpustop"){
|
||||
await inspector.profiler.stop()
|
||||
await inspector.profiler.disable()
|
||||
console.log('CPU profile has been stop')
|
||||
call.succ({
|
||||
code:200,
|
||||
data:"profiler.cpustop"
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user