Motr  M0
trace.c File Reference
#include <limits.h>
#include <ctype.h>
#include <sys/types.h>
#include "lib/errno.h"
#include "lib/atomic.h"
#include "lib/arith.h"
#include "lib/misc.h"
#include "lib/memory.h"
#include "lib/string.h"
#include "lib/cookie.h"
#include "lib/trace.h"
#include "lib/trace_internal.h"
#include "motr/magic.h"
#include "motr/version.h"
Include dependency graph for trace.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYS(name, value)   [value] = #name,
 
#define NULL_STRING_STUB   "(null)"
 

Enumerations

enum  { BOOTLOG_BUF_SIZE = (1 << 16) }
 

Functions

 M0_BASSERT (bootlog.bl_buf==bootlog.bl_area.ta_buf)
 
 M0_BASSERT (((sizeof bootlog.bl_buf) &((sizeof bootlog.bl_buf) - 1))==0)
 
 M0_BASSERT (sizeof(m0_trace_immediate_mask)==8)
 
M0_INTERNAL int m0_trace_init (void)
 
M0_INTERNAL void m0_trace_fini (void)
 
static uint64_t m0_rdtsc (void)
 
static uint32_t calc_string_data_size (const struct m0_trace_descr *td, const void *body)
 
static void copy_string_data (char *dst_str, const char *body, const struct m0_trace_descr *td)
 
M0_INTERNAL void m0_trace_level_allow (unsigned level)
 
M0_INTERNAL void m0_trace_allot (const struct m0_trace_descr *td, const void *body)
 
M0_INTERNAL const char * m0_trace_subsys_name (uint64_t subsys)
 
static char * subsys_str (uint64_t subsys, char *buf)
 
static char * uppercase (char *s)
 
static char * lowercase (char *s)
 
static unsigned long subsys_name_to_mask (char *subsys_name)
 
M0_INTERNAL int m0_trace_subsys_list_to_mask (char *subsys_names, unsigned long *ret_mask)
 
M0_INTERNAL const char * m0_trace_level_name (enum m0_trace_level level)
 
static enum m0_trace_level trace_level_value (char *level_name)
 
static enum m0_trace_level trace_level_value_plus (char *level_name)
 
M0_INTERNAL enum m0_trace_level m0_trace_level_parse (char *str)
 
M0_INTERNAL enum m0_trace_print_context m0_trace_print_context_parse (const char *ctx_name)
 
M0_INTERNAL int m0_trace_set_print_context (const char *ctx_name)
 
M0_INTERNAL int m0_trace_set_level (const char *level_str)
 
M0_INTERNAL const struct m0_trace_buf_headerm0_trace_logbuf_header_get (void)
 
M0_INTERNAL const void * m0_trace_logbuf_get (void)
 
M0_INTERNAL uint32_t m0_trace_logbuf_size_get (void)
 
M0_INTERNAL void m0_trace_logbuf_size_set (size_t size)
 
M0_INTERNAL uint64_t m0_trace_logbuf_pos_get (void)
 
M0_INTERNAL const void * m0_trace_magic_sym_addr_get (void)
 
M0_INTERNAL const char * m0_trace_magic_sym_name_get (void)
 
int m0_trace_magic_sym_extra_addr_add (const void *addr)
 
M0_INTERNAL void m0_trace_print_subsystems (void)
 
M0_INTERNAL int m0_trace_args_unpack (const struct m0_trace_rec_header *trh, m0_trace_rec_args_t args, const void *buf)
 
M0_INTERNAL void m0_trace_record_print (const struct m0_trace_rec_header *trh, const void *buf)
 
void m0_console_printf (const char *fmt,...)
 
static int format_yaml_str (char *str, size_t max_size, size_t align_size)
 
M0_INTERNAL int m0_trace_record_print_yaml (char *outbuf, size_t outbuf_size, const struct m0_trace_rec_header *trh, const void *tr_body, bool yaml_stream_mode)
 
M0_INTERNAL const struct m0_trace_rec_headerm0_trace_last_record_get (void)
 
M0_INTERNAL void m0_trace_buf_header_init (struct m0_trace_buf_header *tbh, size_t buf_size)
 
M0_INTERNAL void m0_trace_switch_to_static_logbuf (void)
 

Variables

static const uint64_t trace_magic_symbol = M0_TRACE_MAGIC
 
static const char trace_magic_symbol_name [] = "trace_magic_symbol"
 
enum { ... }  M0_XCA_DOMAIN
 
struct {
   struct m0_trace_area   bl_area
 
   char   bl_buf [BOOTLOG_BUF_SIZE]
 
bootlog
 
struct m0_trace_buf_headerm0_logbuf_header = &bootlog.bl_area.ta_header
 
void * m0_logbuf = bootlog.bl_area.ta_buf
 
size_t m0_logbufsize = sizeof bootlog.bl_buf
 
static size_t bufmask = sizeof bootlog.bl_buf - 1
 
unsigned long m0_trace_immediate_mask = 0
 
unsigned int m0_trace_print_context = M0_TRACE_PCTX_SHORT
 
unsigned int m0_trace_level = M0_WARN | M0_ERROR | M0_FATAL
 
static const char * trace_subsys_str []
 
struct {
   const char *   name
 
   enum m0_trace_level   level
 
trace_levels []
 
static const char * trace_print_ctx_str []
 
static unsigned allowed_level = UINT_MAX
 

Variable Documentation

◆ bl_area

struct m0_trace_area bl_area

Definition at line 80 of file trace.c.

◆ bl_buf

char bl_buf[BOOTLOG_BUF_SIZE]

Definition at line 81 of file trace.c.

◆ level

enum m0_trace_level level

Definition at line 111 of file trace.c.

◆ name

M0_INTERNAL int const char * name

Definition at line 110 of file trace.c.