Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
tools/power/acpi/tools/ec/ec_access.c
void read_ec_val(int fd, int byte_offset) { uint8_t buf; int error; error = lseek(fd, byte_offset, SEEK_SET); if (error != byte_offset) err(EXIT_FAILURE, "Cannot set offset to 0x%.2x", byte_offset); error = read(fd, &buf, 1); if (error != 1) err(EXIT_FAILURE, "Could not read byte 0x%.2x from %s\n...
[ 0, 0 ]
Linux Kernel
tools/power/acpi/tools/pfrut/pfrut.c
static int valid_log_type(int type) { return type == LOG_EXEC_IDX || type == LOG_HISTORY_IDX; }
[ 0, 0 ]
Linux Kernel
tools/power/acpi/tools/pfrut/pfrut.c
static void help(void) { fprintf(stderr, "usage: %s [OPTIONS]\n" " code injection:\n" " -l, --load\n" " -s, --stage\n" " -a, --activate\n" " -u, --update [stage and activate]\n" " -q, --query\n" " -d, --revid update\n" " ...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/bench/parse.c
struct config *prepare_default_config() { struct config *config = malloc(sizeof(struct config)); dprintf("loading defaults\n"); config->sleep = 500000; config->load = 500000; config->sleep_step = 500000; config->load_step = 500000; config->cycles = 5; config->rounds = 50; config->cpu = 0; config->...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/bench/system.c
long long int get_time() { struct timeval now; gettimeofday(&now, NULL); return (long long int)(now.tv_sec * 1000000LL + now.tv_usec); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/bench/system.c
int set_cpu_affinity(unsigned int cpu) { cpu_set_t cpuset; CPU_ZERO(&cpuset); CPU_SET(cpu, &cpuset); dprintf("set affinity to cpu #%u\n", cpu); if (sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset) < 0) { perror("sched_setaffinity"); fprintf(stderr, "warning: unable to set cpu affinity\n"); ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/bench/system.c
void prepare_user(const struct config *config) { unsigned long sleep_time = 0; unsigned long load_time = 0; unsigned int round; for (round = 0; round < config->rounds; round++) { sleep_time += 2 * config->cycles * (config->sleep + config->sleep_step * round); load_time += 2 * config->cy...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/debug/i386/centrino-decode.c
static void decode(unsigned int msr) { unsigned int multiplier; unsigned int mv; multiplier = ((msr >> 8) & 0xFF); mv = (((msr & 0xFF) * 16) + 700); printf("0x%x means multiplier %d @ %d mV\n", msr, multiplier, mv); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/debug/i386/dump_psb.c
static void decode_psb(char *p, int numpst) { int i; struct psb_header *psb; struct pst_header *pst; psb = (struct psb_header *)p; if (psb->version != 0x12) return; printf("PSB version: %hhx flags: %hhx settling time %hhuus res1 %hhx num pst " "%hhu\n", psb->version, psb->flags, ps...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/debug/i386/powernow-k8-decode.c
int main(int argc, char *argv[]) { int err; int cpu; uint32_t fid, vid; if (argc < 2) cpu = 0; else cpu = strtoul(argv[1], NULL, 0); err = get_fidvid(cpu, &fid, &vid); if (err) { printf("can't get fid, vid from MSR\n"); printf("Possible trouble: you don't run a powernow-k8 capable cpu\...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/debug/kernel/cpufreq-test_tsc.c
static u32 read_pmtmr(void) { u32 v1 = 0, v2 = 0, v3 = 0; do { v1 = inl(pm_tmr_ioport); v2 = inl(pm_tmr_ioport); v3 = inl(pm_tmr_ioport); } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2)); /* mask the output to 24 bits */ return (v2 & 0xFFFFFF); }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/acpi_cppc.c
unsigned long acpi_cppc_get_data(unsigned int cpu, enum acpi_cppc_value which) { unsigned long long value; unsigned int len; char linebuf[MAX_LINE_LEN]; char *endp; if (which >= MAX_CPPC_VALUE_FILES) return 0; len = acpi_cppc_read_file(cpu, acpi_cppc_value_files[which], linebuf, ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname, char *buf, size_t buflen) { char path[SYSFS_PATH_MAX]; snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s", cpu, fname); return cpupower_read_sysfs(path, buf, buflen); }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
char *cpufreq_get_driver(unsigned int cpu) { return sysfs_cpufreq_get_one_string(cpu, SCALING_DRIVER); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
void cpufreq_put_policy(struct cpufreq_policy *policy) { if ((!policy) || (!policy->governor)) return; free(policy->governor); policy->governor = NULL; free(policy); }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
struct cpufreq_available_governors * cpufreq_get_available_governors(unsigned int cpu) { struct cpufreq_available_governors *first = NULL; struct cpufreq_available_governors *current = NULL; char linebuf[MAX_LINE_LEN]; unsigned int pos, i; unsigned int len; len = sysfs_cpufreq_read_file(cpu, "scaling_avai...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
void cpufreq_put_available_governors(struct cpufreq_available_governors *any) { struct cpufreq_available_governors *tmp, *next; if (!any) return; tmp = any->first; while (tmp) { next = tmp->next; if (tmp->governor) free(tmp->governor); free(tmp); tmp = next; } }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *any) { struct cpufreq_affected_cpus *tmp, *next; if (!any) return; tmp = any->first; while (tmp) { next = tmp->next; free(tmp); tmp = next; } }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy) { char min[SYSFS_PATH_MAX]; char max[SYSFS_PATH_MAX]; char gov[SYSFS_PATH_MAX]; int ret; unsigned long old_min; int write_max_first; if (!policy || !(policy->governor)) return -EINVAL; if (policy->max < policy->min) retur...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
int cpufreq_modify_policy_min(unsigned int cpu, unsigned long min_freq) { char value[SYSFS_PATH_MAX]; snprintf(value, SYSFS_PATH_MAX, "%lu", min_freq); return sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_MIN_FREQ, value, strlen(value)); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
struct cpufreq_stats *cpufreq_get_stats(unsigned int cpu, unsigned long long *total_time) { struct cpufreq_stats *first = NULL; struct cpufreq_stats *current = NULL; char one_value[SYSFS_PATH_MAX]; char linebuf[MAX_LINE_LEN]; unsigned int pos, i; unsigned int len; ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpufreq.c
unsigned long cpufreq_get_transitions(unsigned int cpu) { return sysfs_cpufreq_get_one_value(cpu, STATS_NUM_TRANSITIONS); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpuidle.c
static unsigned int cpuidle_state_file_exists(unsigned int cpu, unsigned int idlestate, const char *fname) { char path[SYSFS_PATH_MAX]; struct stat statbuf; snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpuidle/state%u/...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpuidle.c
static unsigned int cpuidle_state_read_file(unsigned int cpu, unsigned int idlestate, const char *fname, char *buf, size_t buflen) { char path[SYSFS_PATH_MAX]; int fd; ssize_t numrea...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpuidle.c
static unsigned int cpuidle_state_write_file(unsigned int cpu, unsigned int idlestate, const char *fname, const char *value, size_t len) { char path[SYSFS_PATH_MAX]; int fd; ssize...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpuidle.c
unsigned long cpuidle_state_latency(unsigned int cpu, unsigned int idlestate) { return cpuidle_state_get_one_value(cpu, idlestate, IDLESTATE_LATENCY); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpuidle.c
char *cpuidle_state_desc(unsigned int cpu, unsigned int idlestate) { return cpuidle_state_get_one_string(cpu, idlestate, IDLESTATE_DESC); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpuidle.c
static char *sysfs_cpuidle_get_one_string(enum cpuidle_string which) { char linebuf[MAX_LINE_LEN]; char *result; unsigned int len; if (which >= MAX_CPUIDLE_STRING_FILES) return NULL; len = sysfs_cpuidle_read_file(cpuidle_string_files[which], linebuf, sizeof(linebuf)); ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpuidle.c
char *cpuidle_get_driver(void) { return sysfs_cpuidle_get_one_string(CPUIDLE_DRIVER); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/lib/cpupower.c
static int sysfs_topology_read_file(unsigned int cpu, const char *fname, int *result) { char linebuf[MAX_LINE_LEN]; char *endp; char path[SYSFS_PATH_MAX]; snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s", cpu, fname); if (cpupower_read_sysfs(path, linebuf, MAX_...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/powercap.c
int powercap_get_enabled(int *mode) { char path[SYSFS_PATH_MAX] = PATH_TO_POWERCAP "/intel-rapl/enabled"; return sysfs_get_enabled(path, mode); }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/powercap.c
int powercap_get_power_uw(struct powercap_zone *zone, uint64_t *val) { return sysfs_powercap_get64_val(zone, GET_POWER_UW, val); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/lib/powercap.c
int powercap_zone_get_enabled(struct powercap_zone *zone, int *mode) { char path[SYSFS_PATH_MAX] = PATH_TO_POWERCAP; if ((strlen(PATH_TO_POWERCAP) + strlen(zone->sys_name)) + strlen("/enabled") + 1 >= SYSFS_PATH_MAX) return -1; strcat(path, "/"); strcat(path, zone->sys_name); strcat(pat...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/lib/powercap.c
struct powercap_zone *powercap_init_zones(void) { int enabled; struct powercap_zone *root_zone; int ret; char file[SYSFS_PATH_MAX] = PATH_TO_RAPL "/enabled"; ret = sysfs_get_enabled(file, &enabled); if (ret) return NULL; if (!enabled) return NULL; root_zone = calloc(1, sizeof(struct powerca...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-info.c
static void proc_cpufreq_output(void) { unsigned int cpu, nr_cpus; struct cpufreq_policy *policy; unsigned int min_pctg = 0; unsigned int max_pctg = 0; unsigned long min, max; printf(_(" minimum CPU frequency - maximum CPU frequency - " "governor\n")); nr_cpus = count_cpus(); ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-info.c
static int get_boost_mode(unsigned int cpu) { struct cpufreq_available_frequencies *freqs; if (cpupower_cpu_info.vendor == X86_VENDOR_AMD || cpupower_cpu_info.vendor == X86_VENDOR_HYGON || cpupower_cpu_info.vendor == X86_VENDOR_INTEL) return get_boost_mode_x86(cpu); freqs = cpufreq_get_boost_fre...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-info.c
static int get_freq_kernel(unsigned int cpu, unsigned int human) { unsigned long freq = cpufreq_get_freq_kernel(cpu); printf(_(" current CPU frequency: ")); if (!freq) { printf(_(" Unable to call to kernel\n")); return -EINVAL; } if (human) { print_speed(freq, no_rounding); } else printf("%...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-info.c
static int get_policy(unsigned int cpu) { struct cpufreq_policy *policy = cpufreq_get_policy(cpu); if (!policy) { printf(_(" Unable to determine current policy\n")); return -EINVAL; } printf(_(" current policy: frequency should be within ")); print_speed(policy->min, no_rounding); printf(_(" and "...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-info.c
static int get_available_governors(unsigned int cpu) { struct cpufreq_available_governors *governors = cpufreq_get_available_governors(cpu); printf(_(" available cpufreq governors: ")); if (!governors) { printf(_("Not Available\n")); return -EINVAL; } while (governors->next) { printf("%s ...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-info.c
static int get_affected_cpus(unsigned int cpu) { struct cpufreq_affected_cpus *cpus = cpufreq_get_affected_cpus(cpu); printf( _(" CPUs which need to have their frequency coordinated by software: ")); if (!cpus) { printf(_("Not Available\n")); return -EINVAL; } while (cpus->next) { printf(...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-set.c
static void print_error(void) { printf(_("Error setting new values. Common errors:\n" "- Do you have proper administration rights? (super-user?)\n" "- Is the governor you requested available and modprobed?\n" "- Trying to set an invalid policy?\n" "- Trying to set a specif...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpufreq-set.c
static void print_unknown_arg(void) { printf(_("invalid or unknown argument\n")); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpuidle-info.c
static void cpuidle_cpu_output(unsigned int cpu, int verbose) { unsigned int idlestates, idlestate; char *tmp; idlestates = cpuidle_state_count(cpu); if (idlestates == 0) { printf(_("CPU %u: No idle states\n"), cpu); return; } printf(_("Number of idle states: %d\n"), idlestates); printf(_("Avail...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpupower-set.c
static void print_wrong_arg_exit(void) { printf(_("invalid or unknown argument\n")); exit(EXIT_FAILURE); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpupower.c
static void print_help(void) { unsigned int i; #ifdef DEBUG printf(_("Usage:\tcpupower [-d|--debug] [-c|--cpu cpulist ] <command> " "[<args>]\n")); #else printf(_("Usage:\tcpupower [-c|--cpu cpulist ] <command> [<args>]\n")); #endif printf(_("Supported commands are:\n")); for (i = 0; i < ARRAY_SI...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpupower.c
static int cmd_help(int argc, const char **argv) { if (argc > 1) { print_man_page(argv[1]); return EXIT_FAILURE; } print_help(); return EXIT_SUCCESS; }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/cpupower.c
int main(int argc, const char *argv[]) { const char *cmd; unsigned int i, ret; struct stat statbuf; struct utsname uts; char pathname[32]; cpus_chosen = bitmask_alloc(sysconf(_SC_NPROCESSORS_CONF)); online_cpus = bitmask_alloc(sysconf(_SC_NPROCESSORS_CONF)); offline_cpus = bitmask_alloc(sysconf(_SC_NPR...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/amd.c
static int get_cof(union core_pstate pstate) { int t; int fid, did, cof; did = get_did(pstate); if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) { fid = pstate.pstatedef.fid; cof = 200 * fid / did; } else { t = 0x10; fid = pstate.pstate.fid; if (cpupower_cpu_info.family == 0x11) ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/amd.c
int decode_pstates(unsigned int cpu, int boost_states, unsigned long *pstates, int *no) { int i, psmax; union core_pstate pstate; unsigned long long val; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_HW_PSTATE)) return -1; if (read_msr(cpu, MSR_AMD_PSTATE_LIMIT, &val)) return -1...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/bitmask.c
struct bitmask *bitmask_alloc(unsigned int n) { struct bitmask *bmp; bmp = malloc(sizeof(*bmp)); if (!bmp) return 0; bmp->size = n; bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long)); if (!bmp->maskp) { free(bmp); return 0; } return bmp; }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/bitmask.c
struct bitmask *bitmask_clearall(struct bitmask *bmp) { unsigned int i; for (i = 0; i < bmp->size; i++) _setbit(bmp, i, 0); return bmp; }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/bitmask.c
static inline int emit(char *buf, int buflen, int rbot, int rtop, int len) { if (len > 0) len += snprintf(buf + len, max(buflen - len, 0), ","); if (rbot == rtop) len += snprintf(buf + len, max(buflen - len, 0), "%d", rbot); else len += snprintf(buf + len, max(buflen - len, 0), "%d-%d", rbot, rtop); ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/bitmask.c
int bitmask_displaylist(char *buf, int buflen, const struct bitmask *bmp) { int len = 0; unsigned int cur, rbot, rtop; if (buflen > 0) *buf = 0; rbot = cur = bitmask_first(bmp); while (cur < bmp->size) { rtop = cur; cur = bitmask_next(bmp, cur + 1); if (cur >= bmp->size || cur > rtop + 1) { ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/helpers.h
static inline void dprint(const char *fmt, ...) {} #endif
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/helpers.h
static inline int cpupower_intel_get_perf_bias(unsigned int cpu) { return -1; }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/helpers.h
static inline unsigned int cpuid_eax(unsigned int op) { return 0; };
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/helpers.h
static inline unsigned int cpuid_ebx(unsigned int op) { return 0; };
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/misc.c
int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, int *states) { int ret; unsigned long long val; *support = *active = *states = 0; if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CPB) { *support = 1; if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_C...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/misc.c
int cpupower_intel_get_perf_bias(unsigned int cpu) { char linebuf[MAX_LINE_LEN]; char path[SYSFS_PATH_MAX]; unsigned long val; char *endp; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) return -1; snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/power/energy_perf_bias", cpu); if (cpupower_...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/misc.c
void print_offline_cpus(void) { int str_len = 0; char *offline_cpus_str = NULL; str_len = offline_cpus->size * 5; offline_cpus_str = (void *)malloc(sizeof(char) * str_len); if (!bitmask_isallclear(offline_cpus)) { bitmask_displaylist(offline_cpus_str, str_len, offline_cpus); printf(_("Following CPUs...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/misc.c
void print_speed(unsigned long speed, int no_rounding) { unsigned long tmp; if (no_rounding) { if (speed > 1000000) printf("%u.%06u GHz", ((unsigned int)speed / 1000000), ((unsigned int)speed % 1000000)); else if (speed > 1000) printf("%u.%03u MHz", ((unsigned int)speed / 1000), ...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/msr.c
unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu) { unsigned long long val; int ret; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_HAS_TURBO_RATIO)) return -1; ret = read_msr(cpu, MSR_NEHALEM_TURBO_RATIO_LIMIT, &val); if (ret) return ret; return val; } #endif
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/pci.c
struct pci_dev *pci_slot_func_init(struct pci_access **pacc, int slot, int func) { return pci_acc_init(pacc, 0, 0, slot, func, -1, -1); } #endif
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/sysfs.c
int sysfs_is_cpu_online(unsigned int cpu) { char path[SYSFS_PATH_MAX]; int fd; ssize_t numread; unsigned long long value; char linebuf[MAX_LINE_LEN]; char *endp; struct stat statbuf; snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u", cpu); if (stat(path, &statbuf) != 0) return 0; snprintf(path...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/sysfs.c
/* * helper function to check whether a file under "../cpuX/cpuidle/stateX/" dir * exists. * For example the functionality to disable c-states was introduced in later * kernel versions, this function can be used to explicitly check for this * feature. * * returns 1 if the file exists, 0 otherwise. */ unsigned i...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/sysfs.c
unsigned int sysfs_idlestate_read_file(unsigned int cpu, unsigned int idlestate, const char *fname, char *buf, size_t buflen) { char path[SYSFS_PATH_MAX]; int fd; ssize_t numread; snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpuid...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/sysfs.c
static unsigned long long sysfs_idlestate_get_one_value(unsigned int cpu, unsigned int idlestate, enum idlestate_value which) { unsigned long long value; unsigned int len; char linebuf[MAX_LINE_LEN]; char *endp; if (which >= MAX_IDLESTATE_VALUE_FILES) return 0; len = sys...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/sysfs.c
unsigned long sysfs_get_idlestate_latency(unsigned int cpu, unsigned int idlestate) { return sysfs_idlestate_get_one_value(cpu, idlestate, IDLESTATE_LATENCY); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/helpers/sysfs.c
char *sysfs_get_idlestate_desc(unsigned int cpu, unsigned int idlestate) { return sysfs_idlestate_get_one_string(cpu, idlestate, IDLESTATE_DESC); }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
static int amd_fam14h_get_pci_info(struct cstate *state, unsigned int *pci_offset, unsigned int *enable_bit, unsigned int cpu) { switch (state->id) { case NON_PC0: *enable_bit = PCI_NON_PC0_ENABLE_BIT; *pci_offset = PCI_NON_PC0_OFFSET; ...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
static int amd_fam14h_disable(cstate_t *state, unsigned int cpu) { int enable_bit, pci_offset, ret; uint32_t val; ret = amd_fam14h_get_pci_info(state, &pci_offset, &enable_bit, cpu); if (ret) return ret; val = pci_read_long(amd_fam14h_pci_dev, pci_offset); dprint("%s: offset: 0x%x %u\n", state->name, ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
static int fam14h_get_count_percent(unsigned int id, double *percent, unsigned int cpu) { unsigned long diff; if (id >= AMD_FAM14H_STATE_NUM) return -1; diff = current_count[id][cpu] - previous_count[id][cpu]; if (timediff == 0) *percent = 0.0; else *percent ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
static int amd_fam14h_start(void) { int num, cpu; clock_gettime(CLOCK_REALTIME, &start_time); for (num = 0; num < AMD_FAM14H_STATE_NUM; num++) { for (cpu = 0; cpu < cpu_count; cpu++) amd_fam14h_init(&amd_fam14h_cstates[num], cpu); } #ifdef DEBUG clock_gettime(CLOCK_REALTIME, &dbg_time); dbg_timed...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
static int cpuidle_get_count_percent(unsigned int id, double *percent, unsigned int cpu) { unsigned long long statediff = current_count[cpu][id] - previous_count[cpu][id]; dprint("%s: - diff: %llu - percent: %f (%u)\n", cpuidle_cstates[id].name, timediff, *percen...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
static int cpuidle_start(void) { int cpu, state; clock_gettime(CLOCK_REALTIME, &start_time); for (cpu = 0; cpu < cpu_count; cpu++) { for (state = 0; state < cpuidle_sysfs_monitor.hw_states_num; state++) { previous_count[cpu][state] = cpuidle_state_time(cpu, state); dprint("CPU %d - State: %d - Va...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
void fix_up_intel_idle_driver_name(char *tmp, int num) { if (!strncmp(tmp, "NHM-", 4)) { switch (num) { case 1: strcpy(tmp, "C1"); break; case 2: strcpy(tmp, "C3"); break; case 3: strcpy(tmp, "C6"); break; } } else if (!strncmp(tmp, "SNB-", 4)) { switch (...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
static struct cpuidle_monitor *cpuidle_register(void) { int num; char *tmp; int this_cpu; this_cpu = sched_getcpu(); cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(this_cpu); if (cpuidle_sysfs_monitor.hw_states_num <= 0) return NULL; for (num = 0; num < cpuidle_sysfs_monitor.hw_states_n...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
void list_monitors(void) { unsigned int mon; int state; cstate_t s; for (mon = 0; mon < avail_monitors; mon++) { printf(_("Monitor \"%s\" (%d states) - Might overflow after %u " "s\n"), monitors[mon]->name, monitors[mon]->hw_states_num, monitors[mon]->overflow_s); fo...
[ 1, 1 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
int do_interval_measure(int i) { unsigned int num; int cpu; if (wake_cpus) for (cpu = 0; cpu < cpu_count; cpu++) bind_cpu(cpu); for (num = 0; num < avail_monitors; num++) { dprint("HW C-state residency monitor: %s - States: %d\n", monitors[num]->name, monitors[num]->hw_states_num); ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
static inline int bind_cpu(int cpu) { cpu_set_t set; if (sched_getaffinity(getpid(), sizeof(set), &set) == 0) { CPU_ZERO(&set); CPU_SET(cpu, &set); return sched_setaffinity(getpid(), sizeof(set), &set); } return 1; }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
static int hsw_ext_get_count_percent(unsigned int id, double *percent, unsigned int cpu) { *percent = 0.0; if (!is_valid[cpu]) return -1; *percent = (100.0 * (current_count[id][cpu] - previous_count[id][cpu])) / (tsc_at_measure_end - tsc_at_measure_start); ...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
static int mperf_get_count_freq(unsigned int id, unsigned long long *count, unsigned int cpu) { unsigned long long aperf_diff, mperf_diff, time_diff, tsc_diff; if (id != AVG_FREQ) return 1; if (!is_valid[cpu]) return -1; mperf_diff = mperf_current_count[cpu] - mperf_pr...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
static int init_maxfreq_mode(void) { int ret; unsigned long long hwcr; unsigned long min; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC)) goto use_sysfs; if (cpupower_cpu_info.vendor == X86_VENDOR_AMD || cpupower_cpu_info.vendor == X86_VENDOR_HYGON) { ret = read_msr(0, MSR_AMD_HWCR, &hw...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
void mperf_unregister(void) { free(mperf_previous_count); free(aperf_previous_count); free(mperf_current_count); free(aperf_current_count); free(is_valid); }
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/nhm_idle.c
static int nhm_start(void) { int num, cpu; unsigned long long dbg, val; nhm_get_count(TSC, &tsc_at_measure_start, base_cpu); for (num = 0; num < NHM_CSTATE_COUNT; num++) { for (cpu = 0; cpu < cpu_count; cpu++) { is_valid[cpu] = !nhm_get_count(num, &val, cpu); previous_count[num][cpu] = val; ...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/nhm_idle.c
struct cpuidle_monitor *intel_nhm_register(void) { int num; if (cpupower_cpu_info.vendor != X86_VENDOR_INTEL) return NULL; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC)) return NULL; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF)) return NULL; is_valid = calloc(cpu_count, sizeof(int...
[ 1, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/rapl_monitor.c
static int rapl_start(void) { int i, ret; uint64_t uj_val; for (i = 0; i < rapl_zone_count; i++) { ret = powercap_get_energy_uj(rapl_zones_pt[i], &uj_val); if (ret) return ret; rapl_zone_previous_count[i] = uj_val; } return 0; }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/snb_idle.c
static int snb_start(void) { int num, cpu; unsigned long long val; for (num = 0; num < SNB_CSTATE_COUNT; num++) { for (cpu = 0; cpu < cpu_count; cpu++) { snb_get_count(num, &val, cpu); previous_count[num][cpu] = val; } } snb_get_count(TSC, &tsc_at_measure_start, base_cpu); return 0; }
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/idle_monitor/snb_idle.c
static int snb_stop(void) { unsigned long long val; int num, cpu; snb_get_count(TSC, &tsc_at_measure_end, base_cpu); for (num = 0; num < SNB_CSTATE_COUNT; num++) { for (cpu = 0; cpu < cpu_count; cpu++) { is_valid[cpu] = !snb_get_count(num, &val, cpu); current_count[num][cpu] = val; } } ...
[ 0, 0 ]
Linux Kernel
tools/power/cpupower/utils/powercap-info.c
static int powercap_print_one_zone(struct powercap_zone *zone) { int mode, i, ret = 0; char pr_prefix[1024] = ""; for (i = 0; i < zone->tree_depth && i < POWERCAP_MAX_TREE_DEPTH; i++) strcat(pr_prefix, "\t"); printf("%sZone: %s", pr_prefix, zone->name); ret = powercap_zone_get_enabled(zone, &mode); i...
[ 1, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/hfi-events.c
static int ack_handler(struct nl_msg *msg, void *arg) { int *err = arg; *err = 0; return NL_STOP; }
[ 0, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/hfi-events.c
static int finish_handler(struct nl_msg *msg, void *arg) { int *ret = arg; *ret = 0; return NL_SKIP; }
[ 0, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/hfi-events.c
static int family_handler(struct nl_msg *msg, void *arg) { struct family_data *res = arg; struct nlattr *tb[CTRL_ATTR_MAX + 1]; struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); struct nlattr *mcgrp; int i; nla_parse(tb, CTRL_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), N...
[ 0, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/hfi-events.c
int hfi_main(void) { struct nl_sock *sock; struct nl_cb *cb; int err = 0; int mcast_id; int no_block = 0; if (!check_hf_suport()) { fprintf(stderr, "CPU Doesn't support HFI\n"); return -1; } sock = nl_socket_alloc(); if (!sock) { fprintf(stderr, "nl_socket_alloc failed\n"); return -1...
[ 0, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/hfi-events.c
void hfi_exit(void) { _hfi_exit = 1; }
[ 0, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/isst-config.c
void debug_printf(const char *format, ...) { va_list args; va_start(args, format); if (debug_flag) vprintf(format, args); va_end(args); }
[ 0, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/isst-config.c
static int update_cpu_model(void) { unsigned int ebx, ecx, edx; unsigned int fms, family; __cpuid(1, fms, ebx, ecx, edx); family = (fms >> 8) & 0xf; cpu_model = (fms >> 4) & 0xf; if (family == 6 || family == 0xf) cpu_model += ((fms >> 16) & 0xf) << 4; cpu_stepping = fms & 0xf; if (is_clx_n_platfo...
[ 1, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/isst-config.c
static int parse_int_file(int fatal, const char *fmt, ...) { va_list args; char path[PATH_MAX]; FILE *filep; int value; va_start(args, fmt); vsnprintf(path, sizeof(path), fmt, args); va_end(args); if (fatal) { filep = fopen_or_exit(path, "r"); } else { filep = fopen(path, "r"); if (!filep...
[ 1, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/isst-config.c
int cpufreq_sysfs_present(void) { DIR *dir; dir = opendir("/sys/devices/system/cpu/cpu0/cpufreq"); if (dir) { closedir(dir); return 1; } return 0; }
[ 0, 0 ]
Linux Kernel
tools/power/x86/intel-speed-select/isst-config.c
static int get_stored_topology_info(int cpu, int *core_id, int *pkg_id, int *die_id) { const char *pathname = "/var/run/isst_cpu_topology.dat"; struct cpu_topology cpu_top; FILE *fp; int ret; fp = fopen(pathname, "rb"); if (!fp) return -1; ret = fseek(fp, cpu * s...
[ 1, 0 ]