/* this function calls every function in sysapi that makes sense to call and prints out its value */ extern "C" void sysapi_test_dump_functions(void) { int foo = 0; long long loo = 0; float bar = 0; const char *qux = NULL; time_t t0, t1; dprintf(D_ALWAYS, "SysAPI: Calling SysAPI functions....\n"); qux = sysapi_ckptpltfrm_raw(); dprintf(D_ALWAYS, "SysAPI: sysapi_ckptpltfrm_raw -> %s\n", qux); qux = sysapi_ckptpltfrm(); dprintf(D_ALWAYS, "SysAPI: sysapi_ckptpltfrm -> %s\n", qux); foo = sysapi_phys_memory_raw(); dprintf(D_ALWAYS, "SysAPI: sysapi_phys_memory_raw() -> %d\n", foo); foo = sysapi_phys_memory(); dprintf(D_ALWAYS, "SysAPI: sysapi_phys_memory() -> %d\n", foo); loo = sysapi_disk_space_raw("/"); dprintf(D_ALWAYS, "SysAPI: sysapi_disk_space_raw() -> %" PRIi64 "\n", loo); loo = sysapi_disk_space("/"); dprintf(D_ALWAYS, "SysAPI: sysapi_disk_space() -> %" PRIi64 "\n", loo); sysapi_ncpus_raw(&foo,NULL); dprintf(D_ALWAYS, "SysAPI: sysapi_ncpus_raw() -> %d\n", foo); sysapi_ncpus_raw(&foo, NULL); dprintf(D_ALWAYS, "SysAPI: sysapi_ncpus() -> %d\n", foo); foo = sysapi_mips_raw(); dprintf(D_ALWAYS, "SysAPI: sysapi_mips_raw() -> %d\n", foo); foo = sysapi_mips(); dprintf(D_ALWAYS, "SysAPI: sysapi_mips() -> %d\n", foo); foo = sysapi_kflops_raw(); dprintf(D_ALWAYS, "SysAPI: sysapi_kflops_raw() -> %d\n", foo); foo = sysapi_kflops(); dprintf(D_ALWAYS, "SysAPI: sysapi_kflops() -> %d\n", foo); sysapi_idle_time_raw(&t0, &t1); dprintf(D_ALWAYS,"SysAPI: sysapi_idle_time_raw() -> (%f,%f)\n",(float)t0,(float)t1); sysapi_idle_time(&t0, &t1); dprintf(D_ALWAYS, "SysAPI: sysapi_idle_time() -> (%f,%f)\n", (float)t0, (float)t1); bar = sysapi_load_avg_raw(); dprintf(D_ALWAYS, "SysAPI: sysapi_load_avg_raw() -> %f\n", bar); bar = sysapi_load_avg(); dprintf(D_ALWAYS, "SysAPI: sysapi_load_avg() -> %f\n", bar); qux = sysapi_condor_arch(); dprintf(D_ALWAYS, "SysAPI: sysapi_condor_arch -> %s\n", qux); qux = sysapi_uname_arch(); dprintf(D_ALWAYS, "SysAPI: sysapi_uname_arch -> %s\n", qux); qux = sysapi_opsys(); dprintf(D_ALWAYS, "SysAPI: sysapi_opsys -> %s\n", qux); foo = sysapi_swap_space_raw(); dprintf(D_ALWAYS, "SysAPI: sysapi_swap_space_raw() -> %d\n", foo); foo = sysapi_swap_space(); dprintf(D_ALWAYS, "SysAPI: sysapi_swap_space() -> %d\n", foo); }
MachAttributes::MachAttributes() : m_user_specified(NULL, ";"), m_user_settings_init(false), m_named_chroot() { m_mips = -1; m_kflops = -1; m_last_benchmark = 0; m_last_keypress = time(0)-1; m_seen_keypress = false; m_arch = NULL; m_opsys = NULL; m_opsysver = 0; m_opsys_and_ver = NULL; m_opsys_major_ver = 0; m_opsys_name = NULL; m_opsys_long_name = NULL; m_opsys_short_name = NULL; m_opsys_legacy = NULL; m_uid_domain = NULL; m_filesystem_domain = NULL; m_idle_interval = -1; m_ckptpltfrm = NULL; m_clock_day = -1; m_clock_min = -1; m_condor_load = -1.0; m_console_idle = 0; m_idle = 0; m_load = -1.0; m_owner_load = -1.0; m_virt_mem = 0; // Number of CPUs. Since this is used heavily by the ResMgr // instantiation and initialization, we need to have a real // value for this as soon as the MachAttributes object exists. m_num_cpus = sysapi_ncpus(); m_num_real_cpus = sysapi_ncpus_raw(); // The same is true of physical memory. If we had an error in // sysapi_phys_memory(), we need to just EXCEPT with a message // telling the user to define MEMORY manually. m_phys_mem = sysapi_phys_memory(); if( m_phys_mem <= 0 ) { dprintf( D_ALWAYS, "Error computing physical memory with calc_phys_mem().\n" ); dprintf( D_ALWAYS | D_NOHEADER, "\t\tMEMORY parameter not defined in config file.\n" ); dprintf( D_ALWAYS | D_NOHEADER, "\t\tTry setting MEMORY to the number of megabytes of RAM.\n" ); EXCEPT( "Can't compute physical memory." ); } dprintf( D_FULLDEBUG, "Memory: Detected %d megs RAM\n", m_phys_mem ); // identification of the checkpointing platform signature const char * ckptpltfrm = param( ATTR_CHECKPOINT_PLATFORM ); if( ckptpltfrm == NULL ) { ckptpltfrm = sysapi_ckptpltfrm(); } m_ckptpltfrm = strdup( ckptpltfrm ); // temporary attributes for raw utsname info m_utsname_sysname = NULL; m_utsname_nodename = NULL; m_utsname_release = NULL; m_utsname_version = NULL; m_utsname_machine = NULL; #if defined ( WIN32 ) // Get the version information of the copy of Windows // we are running ZeroMemory ( &m_window_version_info, sizeof ( OSVERSIONINFOEX ) ); m_window_version_info.dwOSVersionInfoSize = sizeof ( OSVERSIONINFOEX ); m_got_windows_version_info = GetVersionEx ( (OSVERSIONINFO*) &m_window_version_info ); if ( !m_got_windows_version_info ) { m_window_version_info.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO ); m_got_windows_version_info = GetVersionEx ( (OSVERSIONINFO*) &m_window_version_info ); if ( !m_got_windows_version_info ) { dprintf ( D_ALWAYS, "MachAttributes: failed to " "get Windows version information.\n" ); } } m_local_credd = NULL; m_last_credd_test = 0; m_dot_Net_Versions = NULL; #endif }