From 3d296f8b5f04ebc7445894fd1facc4f0ab03d83f Mon Sep 17 00:00:00 2001 From: James Turk Date: Sun, 27 Mar 2011 19:33:13 -0400 Subject: [PATCH] sysinfo demo --- demo/sysinfo.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 demo/sysinfo.py diff --git a/demo/sysinfo.py b/demo/sysinfo.py new file mode 100644 index 0000000..265313c --- /dev/null +++ b/demo/sysinfo.py @@ -0,0 +1,29 @@ +from __future__ import print_function +from csdl import sysinfo + +def main(): + print('Platform:', sysinfo.get_platform()) + print('CPU count:', sysinfo.get_cpu_count()) + print('CPU cache line size:', sysinfo.get_cpu_cache_line_size()) + print(' has 3DNow:', sysinfo.has_3DNow()) + print(' has AltiVec:', sysinfo.has_AltiVec()) + print(' has MMX:', sysinfo.has_MMX()) + print(' has RDTSC:', sysinfo.has_RDTSC()) + print(' has SSE:', sysinfo.has_SSE()) + print(' has SSE2:', sysinfo.has_SSE2()) + print(' has SSE3:', sysinfo.has_SSE3()) + print(' has SSE4.1:', sysinfo.has_SSE41()) + print(' has SSE4.2:', sysinfo.has_SSE42()) + state, seconds, percent = sysinfo.get_power_info() + print('Power:', state, end=' ') + if seconds: + print(seconds, 's remaining', sep='', end=' ') + else: + print('unknown time', end=' ') + if percent: + print(percent, '%', sep='') + else: + print('unknown %') + +if __name__ == '__main__': + main()