libmsr  0.3.0
A friendlier interface to accessing MSRs on Intel platforms
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Macros | Enumerations | Functions
libmsr_error.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NAME_MAX   1024
 

Enumerations

enum  libmsr_error_e {
  LIBMSR_ERROR_RUNTIME = -1,
  LIBMSR_ERROR_PLATFORM_NOT_SUPPORTED = -2,
  LIBMSR_ERROR_ARRAY_BOUNDS = -3,
  LIBMSR_ERROR_MSR_BATCH = -4,
  LIBMSR_ERROR_PLATFORM_ENV = -5,
  LIBMSR_ERROR_MSR_MODULE = -6,
  LIBMSR_ERROR_MSR_OPEN = -7,
  LIBMSR_ERROR_MSR_CLOSE = -8,
  LIBMSR_ERROR_MSR_READ = -9,
  LIBMSR_ERROR_MSR_WRITE = -10,
  LIBMSR_ERROR_RAPL_INIT = -11,
  LIBMSR_ERROR_MSR_INIT = -12,
  LIBMSR_ERROR_INVAL = -13,
  LIBMSR_ERROR_NOT_IMPLEMENTED_YET = -14,
  LIBMSR_ERROR_MEMORY_ALLOCATION = -15,
  LIBMSR_ERROR_CSR_INIT = -16,
  LIBMSR_ERROR_CSR_COUNTERS = -17
}
 Structure encompassing libmsr errors. More...
 

Functions

void libmsr_error_handler (const char *desc, int err, const char *host, const char *filename, int line)
 Display error message to user.
 
char * get_libmsr_error_message (int err)
 Get brief libmsr error message based on error code.
 
void libmsr_error_message (int err, char *msg, size_t size)
 Convert error code to brief libmsr error message.
 

Macro Definition Documentation

#define NAME_MAX   1024

Enumeration Type Documentation

Structure encompassing libmsr errors.

Enumerator:
LIBMSR_ERROR_RUNTIME 

Default error if value is 0 or -1.

LIBMSR_ERROR_PLATFORM_NOT_SUPPORTED 

Features not supported on a given platform (i.e., MSR_TURBO_BOOST_RATIO, PP1 power domain).

LIBMSR_ERROR_ARRAY_BOUNDS 

Accessing array index out of bounds.

LIBMSR_ERROR_MSR_BATCH 

MSR batch problems.

LIBMSR_ERROR_PLATFORM_ENV 

Platform hardware environment (i.e., num sockets, num cores, num threads).

LIBMSR_ERROR_MSR_MODULE 

Access msr or msr_batch modules.

LIBMSR_ERROR_MSR_OPEN 

Opening MSR file descriptors for reads/writes.

LIBMSR_ERROR_MSR_CLOSE 

Closing MSR file descriptors.

LIBMSR_ERROR_MSR_READ 

Reading MSRs.

LIBMSR_ERROR_MSR_WRITE 

Writing MSRs.

LIBMSR_ERROR_RAPL_INIT 

Initializing RAPL.

LIBMSR_ERROR_MSR_INIT 

Initializing MSR.

LIBMSR_ERROR_INVAL 

Invalid value in MSR.

LIBMSR_ERROR_NOT_IMPLEMENTED_YET 

Feature not yet implemented.

LIBMSR_ERROR_MEMORY_ALLOCATION 

Memory allocation.

LIBMSR_ERROR_CSR_INIT 

Initializing CSRs.

LIBMSR_ERROR_CSR_COUNTERS 

CSR counters.

Function Documentation

char* get_libmsr_error_message ( int  err)

Get brief libmsr error message based on error code.

Parameters
[in]errlibmsr_error_e error code, positive values are system errors, negative values are libmsr errors. LIBMSR_ERROR_RUNTIME is assumed if error code is 0.
Returns
Default libmsr error message.
void libmsr_error_handler ( const char *  desc,
int  err,
const char *  host,
const char *  filename,
int  line 
)

Display error message to user.

This is the generic libmsr error handling API. Use this function to report when errors arise. If an error is not defined in libmsr_error_e, add it to the aforementioned enum with the next sequential error code and define its brief error message in the / source file.

Parameters
[in]descExtension to default libmsr error message.
[in]errlibmsr_error_e error code, positive values are system errors, negative values are libmsr errors. LIBMSR_ERROR_RUNTIME is assumed if error code is 0.
[in]hostHostname environment variable.
[in]filenameName of source file where error occurred (use standard predefined macro FILE).
[in]lineLine number in source file where error occurred (use standard predefined macro LINE).
void libmsr_error_message ( int  err,
char *  msg,
size_t  size 
)

Convert error code to brief libmsr error message.

Parameters
[in]errlibmsr_error_e error code, positive values are system errors, negative values are libmsr errors. LIBMSR_ERROR_RUNTIME is assumed if error code is 0.
[in]sizeMax length (in bytes) of brief libmsr error message.
[out]msgBrief libmsr error message.