mirror of
https://github.com/safing/portbase
synced 2026-04-30 04:40:04 +00:00
Add android specific debug info
This commit is contained in:
parent
0d13bca496
commit
5a9e76403d
5 changed files with 75 additions and 39 deletions
|
|
@ -2,14 +2,11 @@ package debug
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/shirou/gopsutil/host"
|
||||
|
||||
"github.com/safing/portbase/info"
|
||||
"github.com/safing/portbase/log"
|
||||
"github.com/safing/portbase/modules"
|
||||
|
|
@ -94,39 +91,6 @@ func (di *Info) AddVersionInfo() {
|
|||
)
|
||||
}
|
||||
|
||||
// AddPlatformInfo adds OS and platform information.
|
||||
func (di *Info) AddPlatformInfo(ctx context.Context) {
|
||||
// Get information from the system.
|
||||
info, err := host.InfoWithContext(ctx)
|
||||
if err != nil {
|
||||
di.AddSection(
|
||||
"Platform Information",
|
||||
NoFlags,
|
||||
fmt.Sprintf("Failed to get: %s", err),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Check if we want to add virtulization information.
|
||||
var virtInfo string
|
||||
if info.VirtualizationRole == "guest" {
|
||||
if info.VirtualizationSystem != "" {
|
||||
virtInfo = fmt.Sprintf("VM: %s", info.VirtualizationSystem)
|
||||
} else {
|
||||
virtInfo = "VM: unidentified"
|
||||
}
|
||||
}
|
||||
|
||||
// Add section.
|
||||
di.AddSection(
|
||||
fmt.Sprintf("Platform: %s %s", info.Platform, info.PlatformVersion),
|
||||
UseCodeSection|AddContentLineBreaks,
|
||||
fmt.Sprintf("System: %s %s (%s) %s", info.Platform, info.OS, info.PlatformFamily, info.PlatformVersion),
|
||||
fmt.Sprintf("Kernel: %s %s", info.KernelVersion, info.KernelArch),
|
||||
virtInfo,
|
||||
)
|
||||
}
|
||||
|
||||
// AddGoroutineStack adds the current goroutine stack.
|
||||
func (di *Info) AddGoroutineStack() {
|
||||
buf := new(bytes.Buffer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue