static g_val_t multi_cpu_sintr_func (int cpu_index) { char *p; cpu_util *cpu = &(cpu_sintr[cpu_index]); if (num_cpustates == NUM_CPUSTATES_24X) { cpu->val.f = 0.; return cpu->val; } p = update_file(&proc_stat); if((proc_stat.last_read.tv_sec != cpu->stamp.tv_sec) && (proc_stat.last_read.tv_usec != cpu->stamp.tv_usec)) { cpu->stamp = proc_stat.last_read; p = find_cpu (p, cpu_index, &cpu->curr_total_jiffies); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_whitespace(p); calculate_utilization (p, cpu); } return cpu->val; }
static void native_add_unallocated_utilization(GHashTable * all_utilization, resource_t * rsc) { if(is_set(rsc->flags, pe_rsc_provisional) == FALSE) { return; } calculate_utilization(all_utilization, rsc->utilization, TRUE); }
static g_val_t multi_cpu_user_func (int cpu_index) { char *p; cpu_util *cpu = &(cpu_user[cpu_index]); p = update_file(&proc_stat); if((proc_stat.last_read.tv_sec != cpu->stamp.tv_sec) && (proc_stat.last_read.tv_usec != cpu->stamp.tv_usec)) { cpu->stamp = proc_stat.last_read; p = find_cpu (p, cpu_index, &cpu->curr_total_jiffies); calculate_utilization (p, cpu); } return cpu->val; }
static g_val_t multi_cpu_nice_func (int cpu_index) { char *p; cpu_util *cpu = &(cpu_nice[cpu_index]); p = update_file(&proc_stat); if((proc_stat.last_read.tv_sec != cpu->stamp.tv_sec) && (proc_stat.last_read.tv_usec != cpu->stamp.tv_usec)) { cpu->stamp = proc_stat.last_read; p = find_cpu (p, cpu_index); p = skip_token(p); p = skip_whitespace(p); calculate_utilization (p, cpu); } return cpu->val; }