Skip to content

Commit

Permalink
Add PID printout
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Apr 6, 2021
1 parent db59f8a commit ce1756d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ func StatusHandler(w http.ResponseWriter, r *http.Request) {
tmplData["CPU"] = c
tmplData["MemStats"] = MemStats{Sys: memstats.Sys, Alloc: memstats.Alloc, TotalAlloc: memstats.TotalAlloc, StackSys: memstats.StackSys, HeapSys: memstats.HeapSys, GCSys: memstats.GCSys, StackInuse: memstats.StackInuse, HeapInuse: memstats.HeapInuse}
var cpuTotal, vsize, rss, openFDs, maxFDs, maxVsize float64
log.Println("das2go PID", os.Getpid())
if proc, err := procfs.NewProc(os.Getpid()); err == nil {
if stat, err := proc.Stat(); err == nil {
// CPUTime returns the total CPU user and system time in seconds.
Expand All @@ -407,6 +408,8 @@ func StatusHandler(w http.ResponseWriter, r *http.Request) {
maxFDs = float64(limits.OpenFiles)
maxVsize = float64(limits.AddressSpace)
}
} else {
log.Println("unable to get procfs info", err)
}
tmplData["CPUTotal"] = cpuTotal
tmplData["VSize"] = vsize
Expand Down

0 comments on commit ce1756d

Please sign in to comment.