Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
sysfs.c File Reference
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "cpufreq.h"

Go to the source code of this file.

Macros

#define PATH_TO_CPU   "/sys/devices/system/cpu/"
 
#define MAX_LINE_LEN   4096
 
#define SYSFS_PATH_MAX   255
 

Enumerations

enum  cpufreq_value {
  CPUINFO_CUR_FREQ, CPUINFO_MIN_FREQ, CPUINFO_MAX_FREQ, CPUINFO_LATENCY,
  SCALING_CUR_FREQ, SCALING_MIN_FREQ, SCALING_MAX_FREQ, STATS_NUM_TRANSITIONS,
  MAX_CPUFREQ_VALUE_READ_FILES
}
 
enum  cpufreq_string { SCALING_DRIVER, SCALING_GOVERNOR, MAX_CPUFREQ_STRING_FILES }
 
enum  cpufreq_write {
  WRITE_SCALING_MIN_FREQ, WRITE_SCALING_MAX_FREQ, WRITE_SCALING_GOVERNOR, WRITE_SCALING_SET_SPEED,
  MAX_CPUFREQ_WRITE_FILES
}
 

Functions

unsigned long sysfs_get_freq_kernel (unsigned int cpu)
 
unsigned long sysfs_get_freq_hardware (unsigned int cpu)
 
unsigned long sysfs_get_freq_transition_latency (unsigned int cpu)
 
int sysfs_get_freq_hardware_limits (unsigned int cpu, unsigned long *min, unsigned long *max)
 
charsysfs_get_freq_driver (unsigned int cpu)
 
struct cpufreq_policysysfs_get_freq_policy (unsigned int cpu)
 
struct
cpufreq_available_governors
sysfs_get_freq_available_governors (unsigned int cpu)
 
struct
cpufreq_available_frequencies
sysfs_get_available_frequencies (unsigned int cpu)
 
struct cpufreq_affected_cpussysfs_get_freq_affected_cpus (unsigned int cpu)
 
struct cpufreq_affected_cpussysfs_get_freq_related_cpus (unsigned int cpu)
 
struct cpufreq_statssysfs_get_freq_stats (unsigned int cpu, unsigned long long *total_time)
 
unsigned long sysfs_get_freq_transitions (unsigned int cpu)
 
int sysfs_modify_freq_policy_governor (unsigned int cpu, char *governor)
 
int sysfs_modify_freq_policy_max (unsigned int cpu, unsigned long max_freq)
 
int sysfs_modify_freq_policy_min (unsigned int cpu, unsigned long min_freq)
 
int sysfs_set_freq_policy (unsigned int cpu, struct cpufreq_policy *policy)
 
int sysfs_set_frequency (unsigned int cpu, unsigned long target_frequency)
 
int sysfs_cpu_exists (unsigned int cpu)
 

Macro Definition Documentation

#define MAX_LINE_LEN   4096

Definition at line 20 of file sysfs.c.

#define PATH_TO_CPU   "/sys/devices/system/cpu/"

Definition at line 19 of file sysfs.c.

#define SYSFS_PATH_MAX   255

Definition at line 21 of file sysfs.c.

Enumeration Type Documentation

Enumerator:
SCALING_DRIVER 
SCALING_GOVERNOR 
MAX_CPUFREQ_STRING_FILES 

Definition at line 141 of file sysfs.c.

Enumerator:
CPUINFO_CUR_FREQ 
CPUINFO_MIN_FREQ 
CPUINFO_MAX_FREQ 
CPUINFO_LATENCY 
SCALING_CUR_FREQ 
SCALING_MIN_FREQ 
SCALING_MAX_FREQ 
STATS_NUM_TRANSITIONS 
MAX_CPUFREQ_VALUE_READ_FILES 

Definition at line 90 of file sysfs.c.

Enumerator:
WRITE_SCALING_MIN_FREQ 
WRITE_SCALING_MAX_FREQ 
WRITE_SCALING_GOVERNOR 
WRITE_SCALING_SET_SPEED 
MAX_CPUFREQ_WRITE_FILES 

Definition at line 180 of file sysfs.c.

Function Documentation

int sysfs_cpu_exists ( unsigned int  cpu)

Definition at line 659 of file sysfs.c.

struct cpufreq_available_frequencies* sysfs_get_available_frequencies ( unsigned int  cpu)
read

Definition at line 328 of file sysfs.c.

struct cpufreq_affected_cpus* sysfs_get_freq_affected_cpus ( unsigned int  cpu)
read

Definition at line 438 of file sysfs.c.

struct cpufreq_available_governors* sysfs_get_freq_available_governors ( unsigned int  cpu)
read

Definition at line 272 of file sysfs.c.

char* sysfs_get_freq_driver ( unsigned int  cpu)

Definition at line 242 of file sysfs.c.

unsigned long sysfs_get_freq_hardware ( unsigned int  cpu)

Definition at line 214 of file sysfs.c.

int sysfs_get_freq_hardware_limits ( unsigned int  cpu,
unsigned long min,
unsigned long max 
)

Definition at line 224 of file sysfs.c.

unsigned long sysfs_get_freq_kernel ( unsigned int  cpu)

Definition at line 209 of file sysfs.c.

struct cpufreq_policy* sysfs_get_freq_policy ( unsigned int  cpu)
read

Definition at line 247 of file sysfs.c.

struct cpufreq_affected_cpus* sysfs_get_freq_related_cpus ( unsigned int  cpu)
read

Definition at line 443 of file sysfs.c.

struct cpufreq_stats* sysfs_get_freq_stats ( unsigned int  cpu,
unsigned long long total_time 
)
read

Definition at line 448 of file sysfs.c.

unsigned long sysfs_get_freq_transition_latency ( unsigned int  cpu)

Definition at line 219 of file sysfs.c.

unsigned long sysfs_get_freq_transitions ( unsigned int  cpu)

Definition at line 507 of file sysfs.c.

int sysfs_modify_freq_policy_governor ( unsigned int  cpu,
char governor 
)

Definition at line 547 of file sysfs.c.

int sysfs_modify_freq_policy_max ( unsigned int  cpu,
unsigned long  max_freq 
)

Definition at line 561 of file sysfs.c.

int sysfs_modify_freq_policy_min ( unsigned int  cpu,
unsigned long  min_freq 
)

Definition at line 572 of file sysfs.c.

int sysfs_set_freq_policy ( unsigned int  cpu,
struct cpufreq_policy policy 
)

Definition at line 583 of file sysfs.c.

int sysfs_set_frequency ( unsigned int  cpu,
unsigned long  target_frequency 
)

Definition at line 630 of file sysfs.c.