File: process_linux.go

package info (click to toggle)
tiup 1.16.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,384 kB
  • sloc: sh: 1,988; makefile: 138; sql: 16
file content (19 lines) | stat: -rw-r--r-- 391 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//go:build linux
// +build linux

package insight

import (
	"log"

	"github.com/shirou/gopsutil/process"
)

func getProcStartTime(proc *process.Process) (float64, error) {
	createTimeMs, err := proc.CreateTime()
	if err != nil {
		log.Fatal(err) // Matches existing error handling behavior
		return 0, err
	}
	return float64(createTimeMs) / 1000.0, nil // Convert milliseconds to seconds
}