uptime command usage is very simple: you can directly enter the uptime.
There is also a parameter-V, is used to query version. (Note the capital letter v)
[Linux @ localhost] $ uptime-V
procps version 3.2.7
[Linux @ localhost] $ uptime
Display results:
10:19:04 up 257 days, 18:56, 12 users, load average: 2.10, 2.10,2.09
Display shows:
10:19:04 / / system current time
up 257 days, 18:56 / / host has run time, time became, indicating that the more stable your machine.
12 user / / user connection, the total number of connections, not users
load average / / the system load average, statistics recently 1,5,15-minute system load average
So what is the average system load it? Average system load is run at a specific time interval, the average number of processes in the queue. If each CPU core, the number of currently active process, not more than 3, then the system performance is good. If the number of tasks for each CPU core is greater than 5, then the performance of this machine have a serious problem. If your linux host is 1 if dual-core CPU, when the Load Average note 6, when the machine has been fully used.
In addition, the following code shows how this kind of start-up time method of computing systems:
#include
#include
struct sysinfo s_info;
long uptime;
int d,h,m,s;
int main()
{
if(0==sysinfo(&s_info))
{
uptime=s_info.uptime;
d=uptime/(3600*24);
h=(uptime/3600)%24;
m=(uptime%3600)/60;
s=(uptime%3600)%60;
printf("d=%d:h=%d:m=%d:s=%d",d,h,m,s);
return 0;
}
return -1;
}
Run Results:
[xxx@wireless time]$ gcc -o uptime uptime.c
[xxx@wireless time]$ ./uptime
d=19:h=0:m=4:s=52
[xxx@wireless time]$
没有评论:
发表评论