JNIEXPORT jlong JNICALL Java_platforms_x86_X86_1DVFS_getTransitionLatency (JNIEnv *env, jobject obj, jint cpu) { return (jlong) cpufreq_get_transition_latency((unsigned long)cpu); }
static void cpu_desc_summary (struct cpu_desc *cpudesc) { printf ("-= CPU Characteristics =-\n"); print_s("Architecture:", cpu_desc_get_architecture (cpudesc)); int cpu_mode = cpu_desc_get_mode (cpudesc); if (cpu_mode) { char mbuf[32], *p = mbuf; if (cpu_mode & MODE_32BIT) { strcpy (p, "32-bit, "); p += 8; } if (cpu_mode & MODE_64BIT) { strcpy (p, "64-bit, "); p += 8; } *(p - 2) = '\0'; print_s("CPU op-mode(s):", mbuf); } #if !defined(WORDS_BIGENDIAN) print_s("Byte Order:", "Little Endian"); #else print_s("Byte Order:", "Big Endian"); #endif int cpu, ncpus = cpu_desc_get_ncpus (cpudesc); print_d("CPU(s):", ncpus); unsigned int nsockets, ncores, nthreads; get_cputopology_read (&nsockets, &ncores, &nthreads); print_u("Thread(s) per core:", nthreads); print_u("Core(s) per socket:", ncores); print_u("Socket(s):", nsockets); print_s("Vendor ID:", cpu_desc_get_vendor (cpudesc)); print_s("CPU Family:", cpu_desc_get_family (cpudesc)); print_s("Model:", cpu_desc_get_model (cpudesc)); print_s("Model name:", cpu_desc_get_model_name (cpudesc)); for (cpu = 0; cpu < ncpus; cpu++) { printf ("-CPU%d-\n", cpu); bool cpu_hot_pluggable = get_processor_is_hot_pluggable (cpu); int cpu_online = get_processor_is_online (cpu); print_s ("CPU is Hot Pluggable:", cpu_hot_pluggable ? (cpu_online ? "yes (online)" : "yes (offline)") : "no"); unsigned long latency = cpufreq_get_transition_latency (cpu); if (latency) print_s("Maximum Transition Latency:", cpufreq_duration_to_string (latency)); unsigned long freq_kernel = cpufreq_get_freq_kernel (cpu); if (freq_kernel > 0) print_s("Current CPU Frequency:", cpufreq_freq_to_string (freq_kernel)); struct cpufreq_available_frequencies *cpufreqs, *curr; cpufreqs = curr = cpufreq_get_available_freqs (cpu); if (curr) { print_key_s("Available CPU Frequencies:"); while (curr) { printf ("%s ", cpufreq_freq_to_string (cpufreq_get_available_freqs_value (curr))); curr = cpufreq_get_available_freqs_next (curr); } printf ("\n"); cpufreq_available_frequencies_unref(cpufreqs); } unsigned long freq_min, freq_max; if (0 == cpufreq_get_hardware_limits (cpu, &freq_min, &freq_max)) { char *min_s = cpufreq_freq_to_string (freq_min), *max_s = cpufreq_freq_to_string (freq_max); print_range_s("Hardware Limits:", min_s, max_s); free (min_s); free (max_s); } char *freq_governor = cpufreq_get_governor (cpu); if (freq_governor) { print_s ("CPU Freq Current Governor:", freq_governor); free (freq_governor); } char *freq_governors = cpufreq_get_available_governors (cpu); if (freq_governors) { print_s ("CPU Freq Available Governors:", freq_governors); free (freq_governors); } char *freq_driver = cpufreq_get_driver (cpu); if (freq_driver) { print_s ("CPU Freq Driver:", freq_driver); free (freq_driver); } } char *cpu_virtflag = cpu_desc_get_virtualization_flag (cpudesc); if (cpu_virtflag) print_s("Virtualization:", cpu_virtflag); }