Julien Delplanque wrote:
I can't find out how to get the uptime of the OS from pharo
(FileSystem disk root / 'proc' / 'uptime') asFileReference readStreamDo: [:s | s upToEnd asString ] or if you load the "OSUnix" project in Pharo 4 from the config browser it is even easier: UnixSystem upTime bye T.
2015-03-19 9:05 GMT+01:00 Torsten Bergmann <astares@gmx.de>:
Julien Delplanque wrote:
I can't find out how to get the uptime of the OS from pharo
(FileSystem disk root / 'proc' / 'uptime') asFileReference readStreamDo: [:s | s upToEnd asString ]
or if you load the "OSUnix" project in Pharo 4 from the config browser it is even easier:
UnixSystem upTime
bye T.
And, if there is a system library that provides this data, there is the NativeBoost way: For example( not linux but windows): new method: NBWin32Shell>>#getUptime <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( ulonglong GetTickCount64() ) module: #Kernel32 and then you can call it like that: NBWin32Shell getUptime milliSeconds.
And, if there is a system library that provides this data, there is the NativeBoost way: For example( not linux but windows):
new method: NBWin32Shell>>#getUptime
<primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( ulonglong GetTickCount64() ) module: #Kernel32
and then you can call it like that: NBWin32Shell getUptime milliSeconds.
Ok, nice to see there are different way to do it :) But I think I'll use Torsten's solution. Thank for the response anyway :) Julien
2015-03-19 10:27 GMT+01:00 Julien Delplanque <julien@tamere.eu>:
And, if there is a system library that provides this data, there is the NativeBoost way: For example( not linux but windows):
new method: NBWin32Shell>>#getUptime
<primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( ulonglong GetTickCount64() ) module: #Kernel32
and then you can call it like that: NBWin32Shell getUptime milliSeconds.
Ok, nice to see there are different way to do it :)
But I think I'll use Torsten's solution.
Thank for the response anyway :)
Ah, I just saw, he already provides the same in OS-Windows.
Julien
(FileSystem disk root / 'proc' / 'uptime') asFileReference readStreamDo: [:s | s upToEnd asString ]
or if you load the "OSUnix" project in Pharo 4 from the config browser it is even easier:
UnixSystem upTime
bye T.
Thank you, that's exactly what I was looking for, I'll check it later. Julien
participants (3)
-
Julien Delplanque -
Nicolai Hess -
Torsten Bergmann