这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Conversation

@d10v
Copy link
Contributor

@d10v d10v commented Jun 19, 2015

Calculate process start time and uptime from file stat data of /proc/ directory.

P.S. Chose this because it's way simpler than querying uptime, getconf CLK_TCK , parsing stat and jiffies. There were times when /proc/<pid> stat data was modifiable but that's fixed now.

Review on Reviewable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the uptime of the program. It is the uptime of the program since scollector has been running. I don't see the value of this metric, since one can always just subtract the start time and a timestamp to figure out uptime.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I'm wrong. timestamp is updated to be now. But use now() to get it because it's race-free.

@d10v d10v force-pushed the process-linux-starttime branch from a6363d9 to d49b92f Compare June 19, 2015 21:52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use now() for this:

func now() (t int64) {

@d10v d10v force-pushed the process-linux-starttime branch from d49b92f to 9fe0b0d Compare June 22, 2015 10:14
madelynnblue added a commit that referenced this pull request Jun 22, 2015
cmd/scollector: process_linux process start_time and uptime
@madelynnblue madelynnblue merged commit ab5e827 into bosun-monitor:master Jun 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants