Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-01

Computer/Server uptime (Linux)

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Udo Giacomozzi

Hello,

anybody knows how to find out the time the computer is running under Linux?

I want to display the same time the Linux program "top" is displaying in the top left corner (ex. "up 27 days, 23:26").

Is that possible? If yes, how?

And (less important) maybe also the current IDLE level (ex. "99.2%")?

Many thanks in advance,
Udo

Reply by email

Peter Vreman
to Udo Giacomozzi
Show quoted text 9 lines
anybody knows how to find out the time the computer is running under Linux? I want to display the same time the Linux program "top" is displaying in the top left corner (ex. "up 27 days, 23:26"). Is that possible? If yes, how? And (less important) maybe also the current IDLE level (ex. "99.2%")?

Look in the /proc filesystem. You can use 'strace top 2> strace.txt' to get a list of files to use. For the running time (uptime) it's /proc/uptime

Reply by email

Marco van de Voort
to Udo Giacomozzi: anybody knows how to find out the time the computer is running under Linux? I want to…
Show quoted text 9 lines
anybody knows how to find out the time the computer is running under Linux? I want to display the same time the Linux program "top" is displaying in the top left corner (ex. "up 27 days, 23:26"). Is that possible? If yes, how? And (less important) maybe also the current IDLE level (ex. "99.2%")?

Try to pipe uptime (perhaps with some params) and parse it..

Or (more fundamentally), reverse engineer it, or the program top. The calls that are used are probably sysctl.

Marco van de Voort ( or )

Reply by email

Daniel Kinnaer
to Peter Vreman: Look in the /proc filesystem. You can use 'strace top 2> strace.txt' to get a list of…

Is it also possible to show the uptime for the WinNT/2000 environment?

best regards,
Daniel

Earlier message 26 lines
-----Original Message----- From: Behalf Of Peter Vreman Sent: zaterdag 6 januari 2001 22:30 To: Subject: Re: [fpc-pascal]Computer/Server uptime (Linux) > anybody knows how to find out the time the computer is running under > Linux? > > I want to display the same time the Linux program "top" is displaying > in the top left corner (ex. "up 27 days, 23:26"). > > Is that possible? If yes, how? > > And (less important) maybe also the current IDLE level (ex. "99.2%")? Look in the /proc filesystem. You can use 'strace top 2> strace.txt' to get a list of files to use. For the running time (uptime) it's /proc/uptime

Reply by email

Unknown author
to Udo Giacomozzi: anybody knows how to find out the time the computer is running under Linux? I want to…
Udo Giacomozzi wrote 15 lines
Hello, anybody knows how to find out the time the computer is running under Linux? I want to display the same time the Linux program "top" is displaying in the top left corner (ex. "up 27 days, 23:26"). Is that possible? If yes, how? And (less important) maybe also the current IDLE level (ex. "99.2%")? Many thanks in advance, Udo

Use the command uptime, or cat /proc/uptime

Reply by email

Udo Giacomozzi
to Unknown author

Hello nuitari,

Sunday, January 07, 2001, 3:53:52 AM, you wrote:

ndc> Udo Giacomozzi wrote 15 lines
> > Hello, > > anybody knows how to find out the time the computer is running under > Linux? > > I want to display the same time the Linux program "top" is displaying > in the top left corner (ex. "up 27 days, 23:26"). > > Is that possible? If yes, how? > > And (less important) maybe also the current IDLE level (ex. "99.2%")? > > Many thanks in advance, > Udo

ndc> Use the command uptime, or cat /proc/uptime

Many thanks for all your answers. /proc/uptime tells me both uptime and idle level :)

Best regards, Udo

Reply by email