float Starter::percentCpuUsage( void ) { if (daemonCore->Get_Family_Usage(s_pid, s_usage, true) == FALSE) { EXCEPT( "Starter::percentCpuUsage(): Fatal error getting process " "info for the starter and decendents" ); } // In vm universe, there may be a process dealing with a VM. // Unfortunately, such a process is created by a specific // running daemon for virtual machine program(such as vmware-serverd). // So our Get_Family_Usage is unable to get usage for the process. // Here, we call a function in vm universe manager. // If this starter is for vm universe, s_usage will be updated. // Otherwise, s_usage will not change. if ( resmgr ) { resmgr->m_vmuniverse_mgr.getUsageForVM(s_pid, s_usage); // Now try to tack on details posted in the job ad because // hypervisors such as libvirt will spawn processes outside // of condor's perview. float fPercentCPU=0.0; int iNumCPUs=0; ClassAd * jobAd = s_claim->ad(); jobAd->LookupFloat(ATTR_JOB_VM_CPU_UTILIZATION, fPercentCPU); jobAd->LookupInteger(ATTR_JOB_VM_VCPUS, iNumCPUs); // computations outside take cores into account. fPercentCPU = fPercentCPU * iNumCPUs; dprintf( D_LOAD, "Starter::percentCpuUsage() adding VM Utilization %f\n",fPercentCPU); s_usage.percent_cpu += fPercentCPU; } if( IsDebugVerbose(D_LOAD) ) { dprintf(D_LOAD, "Starter::percentCpuUsage(): Percent CPU usage " "for the family of starter with pid %u is: %f\n", s_pid, s_usage.percent_cpu ); } return s_usage.percent_cpu; }
void printClassAd( void ) { printf( "%s = \"%s\"\n", ATTR_VERSION, CondorVersion() ); printf( "%s = True\n", ATTR_IS_DAEMON_CORE ); printf( "%s = True\n", ATTR_HAS_FILE_TRANSFER ); printf( "%s = True\n", ATTR_HAS_PER_FILE_ENCRYPTION ); printf( "%s = True\n", ATTR_HAS_RECONNECT ); printf( "%s = True\n", ATTR_HAS_MPI ); printf( "%s = True\n", ATTR_HAS_TDP ); printf( "%s = True\n", ATTR_HAS_JOB_DEFERRAL ); /* Attributes describing what kinds of Job Info Communicators this starter has. This is mostly for COD, but someday might be useful to other people, too. There's no need to advertise the fact we've got a JICShadow, since all starters always have and will be able to communicate with a shadow... */ printf( "%s = True\n", ATTR_HAS_JIC_LOCAL_CONFIG ); printf( "%s = True\n", ATTR_HAS_JIC_LOCAL_STDIN ); ClassAd *ad = java_detect(); if(ad) { int gotone=0; float mflops; char *str = 0; if(ad->LookupString(ATTR_JAVA_VENDOR,&str)) { printf("%s = \"%s\"\n",ATTR_JAVA_VENDOR,str); free(str); str = 0; gotone++; } if(ad->LookupString(ATTR_JAVA_VERSION,&str)) { printf("%s = \"%s\"\n",ATTR_JAVA_VERSION,str); free(str); str = 0; gotone++; } if(ad->LookupString("JavaSpecificationVersion",&str)) { printf("JavaSpecificationVersion = \"%s\"\n",str); free(str); str = 0; gotone++; } if(ad->LookupFloat(ATTR_JAVA_MFLOPS,mflops)) { printf("%s = %f\n", ATTR_JAVA_MFLOPS,mflops); gotone++; } if(gotone>0) printf( "%s = True\n",ATTR_HAS_JAVA); delete ad; } // VM universe stuff if( VMProc::vm_univ_detect() ) { // This doesn't mean that vm universe is really available. // This just means that starter has codes for vm universe. // Actual testing for vm universe will be // done by vmuniverse manager in startd. // ATTR_HAS_VM may be overwritten by vmuniverse manager in startd printf( "%s = True\n",ATTR_HAS_VM); } // Advertise which file transfer plugins are supported FileTransfer ft; CondorError e; ft.InitializePlugins(e); if (e.code()) { dprintf(D_ALWAYS, "WARNING: Initializing plugins returned: %s\n", e.getFullText().c_str()); } MyString method_list = ft.GetSupportedMethods(); if (!method_list.IsEmpty()) { printf("%s = \"%s\"\n", ATTR_HAS_FILE_TRANSFER_PLUGIN_METHODS, method_list.Value()); } #if defined(WIN32) // Advertise our ability to run jobs as the submitting user printf("%s = True\n", ATTR_HAS_WIN_RUN_AS_OWNER); #endif }