SpiNNFrontEndCommon 7.3.1
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
Macros | Functions
debug.h File Reference

SpiNNaker debug header file. More...

#include <stdint.h>
#include "spin-print.h"
#include <assert.h>

Go to the source code of this file.

Macros

#define log_mini_error(message, ...)    __log_mini(LOG_ERROR, message, ##__VA_ARGS__)
 This macro logs errors. Do not call directly!
 
#define log_mini_warning(message, ...)    __log_mini(LOG_WARNING, message, ##__VA_ARGS__)
 This macro logs warnings. Do not call directly!
 
#define log_mini_info(message, ...)    __log_mini(LOG_INFO, message, ##__VA_ARGS__)
 This macro logs information. Do not call directly!
 
#define log_mini_debug(message, ...)    __log_mini(LOG_DEBUG, message, ##__VA_ARGS__)
 This macro logs debug messages. Do not call directly!
 

Functions

void log_error (const char *message,...)
 This function logs errors. Errors usually indicate a serious fault in the program, and that it is about to terminate abnormally (RTE).
 
void log_warning (const char *message,...)
 This function logs warnings.
 
void log_info (const char *message,...)
 This function logs informational messages. This is the lowest level of message normally printed.
 
void log_debug (const char *message,...)
 This function logs debugging messages. This level of message is normally not printed except when the binary is built in debug mode.
 
static uint32_t float_to_int (float f)
 Type-pun a float as a 32-bit unsigned integer.
 
static uint32_t double_to_lower (double d)
 Type-pun the lower 32 bits of a double as a 32-bit unsigned integer.
 
static uint32_t double_to_upper (double d)
 Type-pun the higher 32 bits of a double as a 32-bit unsigned integer.
 

Detailed Description

SpiNNaker debug header file.

Author
Dave Lester (david.nosp@m..r.l.nosp@m.ester.nosp@m.@man.nosp@m.chest.nosp@m.er.a.nosp@m.c.uk)
Date
12 December, 2013

ORIGINAL DETAILS

Created on       : 12 December 2013
Version          : $Revision$
Last modified on : $Date$
Last modified by : $Author$
$Id$

DESCRIPTION

A header file that can be used to incorporate and control debug information. It is switched ON by default; to switch OFF, the code is compiled with

-DPRODUCTION_CODE

or

-DNDEBUG

By default it is used for SpiNNaker ARM code; it can also be used in host-side C, by compiling with -DDEBUG_ON_HOST

EXAMPLES

To use, you must ‘hash-include’ debug.h:

Logging errors, warnings and info:

log_error(17, "error");                    // not the most useful message..
log_warning(0, "variable x = %8x", 0xFF);  // variable printing
log_info("function f entered");            // trace

Definition in file debug.h.

Macro Definition Documentation

◆ log_mini_error

#define log_mini_error (   message,
  ... 
)     __log_mini(LOG_ERROR, message, ##__VA_ARGS__)

This macro logs errors. Do not call directly!

Parameters
[in]messageThe user-defined part of the error message.

Definition at line 187 of file debug.h.

◆ log_mini_warning

#define log_mini_warning (   message,
  ... 
)     __log_mini(LOG_WARNING, message, ##__VA_ARGS__)

This macro logs warnings. Do not call directly!

Parameters
[in]messageThe user-defined part of the error message.

Definition at line 192 of file debug.h.

◆ log_mini_info

#define log_mini_info (   message,
  ... 
)     __log_mini(LOG_INFO, message, ##__VA_ARGS__)

This macro logs information. Do not call directly!

Parameters
[in]messageThe user-defined part of the error message.

Definition at line 197 of file debug.h.

◆ log_mini_debug

#define log_mini_debug (   message,
  ... 
)     __log_mini(LOG_DEBUG, message, ##__VA_ARGS__)

This macro logs debug messages. Do not call directly!

Parameters
[in]messageThe user-defined part of the error message.

Definition at line 202 of file debug.h.

Function Documentation

◆ log_error()

void log_error ( const char message,
  ... 
)
extern

This function logs errors. Errors usually indicate a serious fault in the program, and that it is about to terminate abnormally (RTE).

Calls to this function are rewritten during the build process to be calls to log_mini_error(); the rewrite also encodes the message so that it is handled more efficiently by the binary deployed to SpiNNaker.

Parameters
[in]messageThe user-defined part of the error message.

◆ log_warning()

void log_warning ( const char message,
  ... 
)
extern

This function logs warnings.

Calls to this function are rewritten during the build process to be calls to log_mini_warning(); the rewrite also encodes the message so that it is handled more efficiently by the binary deployed to SpiNNaker.

Parameters
[in]messageThe user-defined part of the error message.

◆ log_info()

void log_info ( const char message,
  ... 
)
extern

This function logs informational messages. This is the lowest level of message normally printed.

Calls to this function are rewritten during the build process to be calls to log_mini_info(); the rewrite also encodes the message so that it is handled more efficiently by the binary deployed to SpiNNaker.

Parameters
[in]messageThe user-defined part of the error message.

◆ log_debug()

void log_debug ( const char message,
  ... 
)
extern

This function logs debugging messages. This level of message is normally not printed except when the binary is built in debug mode.

Calls to this function are rewritten during the build process to be calls to log_mini_debug(); the rewrite also encodes the message so that it is handled more efficiently by the binary deployed to SpiNNaker.

Parameters
[in]messageThe user-defined part of the error message.

◆ float_to_int()

static uint32_t float_to_int ( float  f)
inlinestatic

Type-pun a float as a 32-bit unsigned integer.

Defeats unwanted casting.

Parameters
[in]fThe floating point number
Returns
The integer that is the bits of the float

Definition at line 121 of file debug.h.

◆ double_to_lower()

static uint32_t double_to_lower ( double  d)
inlinestatic

Type-pun the lower 32 bits of a double as a 32-bit unsigned integer.

Defeats unwanted casting.

Parameters
[in]dThe floating point number
Returns
The integer that is the lower bits of the double

Definition at line 142 of file debug.h.

◆ double_to_upper()

static uint32_t double_to_upper ( double  d)
inlinestatic

Type-pun the higher 32 bits of a double as a 32-bit unsigned integer.

Defeats unwanted casting.

Parameters
[in]dThe floating point number
Returns
The integer that is the higher bits of the double

Definition at line 158 of file debug.h.