"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/xlators/debug/trace/src/trace.h" (16 Sep 2020, 2125 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "trace.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2    Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com>
    3    This file is part of GlusterFS.
    4 
    5    This file is licensed to you under your choice of the GNU Lesser
    6    General Public License, version 3 or any later version (LGPLv3 or
    7    later), or the GNU General Public License, version 2 (GPLv2), in all
    8    cases as published by the Free Software Foundation.
    9 */
   10 
   11 #include <time.h>
   12 #include <errno.h>
   13 #include <glusterfs/glusterfs.h>
   14 #include <glusterfs/xlator.h>
   15 #include <glusterfs/common-utils.h>
   16 #include <glusterfs/event-history.h>
   17 #include <glusterfs/logging.h>
   18 #include <glusterfs/circ-buff.h>
   19 #include <glusterfs/statedump.h>
   20 #include <glusterfs/options.h>
   21 
   22 #define TRACE_DEFAULT_HISTORY_SIZE 1024
   23 
   24 typedef struct {
   25     /* Since the longest fop name is fremovexattr i.e 12 characters, array size
   26      * is kept 24, i.e double of the maximum.
   27      */
   28     char name[24];
   29     int enabled;
   30 } trace_fop_name_t;
   31 
   32 trace_fop_name_t trace_fop_names[GF_FOP_MAXVALUE];
   33 
   34 typedef struct {
   35     gf_boolean_t log_file;
   36     gf_boolean_t log_history;
   37     uint64_t history_size;
   38     int trace_log_level;
   39 } trace_conf_t;
   40 
   41 #define TRACE_STACK_UNWIND(op, frame, params...)                               \
   42     do {                                                                       \
   43         frame->local = NULL;                                                   \
   44         STACK_UNWIND_STRICT(op, frame, params);                                \
   45     } while (0);
   46 
   47 #define LOG_ELEMENT(_conf, _string)                                            \
   48     do {                                                                       \
   49         if (_conf) {                                                           \
   50             if ((_conf->log_history) == _gf_true)                              \
   51                 gf_log_eh("%s", _string);                                      \
   52             if ((_conf->log_file) == _gf_true)                                 \
   53                 gf_log(THIS->name, _conf->trace_log_level, "%s", _string);     \
   54         }                                                                      \
   55     } while (0);