提交 41ce6c57 编写于 作者: K Kohsuke Kawaguchi

track uptime

上级 e68ec055
package jenkins.model;
import hudson.Extension;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
/**
* Keeps track of the uptime of Jenkins.
*
* @author Kohsuke Kawaguchi
* @since 1.538
*/
@Extension
public class Uptime {
private long startTime;
/**
* Timestamp in which Jenkins became fully up and running.
*/
public long getStartTime() {
return startTime;
}
public long getUptime() {
return System.currentTimeMillis()-startTime;
}
@Initializer(after=InitMilestone.JOB_LOADED)
public static void init() {
Jenkins.getInstance().getInjector().getInstance(Uptime.class).startTime = System.currentTimeMillis();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册