mirror of
https://github.com/bloeys/nterm.git
synced 2025-12-29 06:28:20 +00:00
Continue SGR parse even if reset is found+Heap pprof profile
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,7 +16,7 @@
|
||||
|
||||
# Custom
|
||||
*.png
|
||||
*.cpu
|
||||
*.pprof
|
||||
|
||||
1gb.txt
|
||||
1gb.bin
|
||||
|
||||
@ -273,6 +273,7 @@ func InfoFromAnsiCode(code []byte) (info AnsiCodeInfo) {
|
||||
|
||||
func ParseSGRArgs(args []byte) (payload []AnsiCodeInfoPayload) {
|
||||
|
||||
// @PERF: Too many allocations here, once per code :/
|
||||
payload = make([]AnsiCodeInfoPayload, 0, 1)
|
||||
|
||||
// @TODO should we trim spaces?
|
||||
@ -283,7 +284,7 @@ func ParseSGRArgs(args []byte) (payload []AnsiCodeInfoPayload) {
|
||||
payload = append(payload, AnsiCodeInfoPayload{
|
||||
Type: AnsiCodePayloadType_Reset,
|
||||
})
|
||||
break
|
||||
continue
|
||||
}
|
||||
|
||||
// @TODO We can't use this setup of one info field because one ansi code can have many settings.
|
||||
|
||||
6
main.go
6
main.go
@ -180,7 +180,7 @@ func main() {
|
||||
p.win.SDLWin.GLSwap()
|
||||
|
||||
if consts.Mode_Debug {
|
||||
var pf, _ = os.Create("pprof.cpu")
|
||||
var pf, _ = os.Create("cpu.pprof")
|
||||
defer pf.Close()
|
||||
pprof.StartCPUProfile(pf)
|
||||
}
|
||||
@ -189,6 +189,10 @@ func main() {
|
||||
|
||||
if consts.Mode_Debug {
|
||||
pprof.StopCPUProfile()
|
||||
|
||||
var heapProfile, _ = os.Create("heap.pprof")
|
||||
defer heapProfile.Close()
|
||||
pprof.WriteHeapProfile(heapProfile)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user