AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
debug.cpp File Reference

Implements the AJADebug class. More...

#include "ajabase/common/common.h"
#include "ajabase/system/atomic.h"
#include "ajabase/system/debug.h"
#include "ajabase/system/memory.h"
#include "ajabase/system/lock.h"
#include "ajabase/system/process.h"
#include "ajabase/system/system.h"
#include "ajabase/system/systemtime.h"
#include "ajabase/system/thread.h"
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <map>
Include dependency graph for debug.cpp:

Go to the source code of this file.

Macros

#define addDebugGroupToLabelVector(x)   sGroupLabelVector.push_back(#x)
 
#define STAT_BIT_SHIFT   (1ULL<<(inKey%64))
 
#define STAT_BIT_TEST   (spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] & STAT_BIT_SHIFT)
 
#define IS_STAT_BAD   !STAT_BIT_TEST
 
#define STAT_BIT_SET   spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] |= STAT_BIT_SHIFT
 
#define STAT_BIT_CLEAR   spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] &= 0xFFFFFFFFFFFFFFFF - STAT_BIT_SHIFT
 
#define HEX0N(__x__, __n__)   std::hex << std::uppercase << std::setw(int(__n__)) << std::setfill('0') << (__x__) << std::dec << std::setfill(' ') << std::nouppercase
 

Typedefs

typedef map< int, string > StatKeyNameMap
 
typedef pair< int, string > StatKeyNamePair
 
typedef StatKeyNameMap::iterator StatKeyNameMapIter
 
typedef StatKeyNameMap::const_iterator StatKeyNameMapConstIter
 

Functions

int64_t debug_time (void)
 
uint64_t report_common (int32_t index, int32_t severity, const char *pFileName, int32_t lineNumber, uint64_t &writeIndex, int32_t &messageIndex)
 
std::string AJAStatusToString (const AJAStatus inStatus, const bool inDetailed)
 
static bool gStatKeyToStrReady (false)
 
static void InitStatKeyNames (void)
 
std::ostream & operator<< (std::ostream &oss, const AJADebugStat &inStat)
 

Variables

static std::vector< std::string > sGroupLabelVector
 
static const std::string sSeverityString [] = {"emergency", "alert", "assert", "error", "warning", "notice", "info", "debug"}
 
static AJALock sLock
 
static AJADebugSharespShare = NULL
 
static bool sDebug = false
 
static StatKeyNameMap gStatKeyToStr
 
static AJALock gStatKeyToStrLock
 

Detailed Description

Implements the AJADebug class.

Definition in file debug.cpp.

Macro Definition Documentation

◆ addDebugGroupToLabelVector

#define addDebugGroupToLabelVector (   x)    sGroupLabelVector.push_back(#x)

Definition at line 35 of file debug.cpp.

◆ HEX0N

#define HEX0N (   __x__,
  __n__ 
)    std::hex << std::uppercase << std::setw(int(__n__)) << std::setfill('0') << (__x__) << std::dec << std::setfill(' ') << std::nouppercase

Definition at line 1175 of file debug.cpp.

◆ IS_STAT_BAD

#define IS_STAT_BAD   !STAT_BIT_TEST

Definition at line 39 of file debug.cpp.

◆ STAT_BIT_CLEAR

#define STAT_BIT_CLEAR   spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] &= 0xFFFFFFFFFFFFFFFF - STAT_BIT_SHIFT

Definition at line 41 of file debug.cpp.

◆ STAT_BIT_SET

#define STAT_BIT_SET   spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] |= STAT_BIT_SHIFT

Definition at line 40 of file debug.cpp.

◆ STAT_BIT_SHIFT

#define STAT_BIT_SHIFT   (1ULL<<(inKey%64))

Definition at line 37 of file debug.cpp.

◆ STAT_BIT_TEST

#define STAT_BIT_TEST   (spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] & STAT_BIT_SHIFT)

Definition at line 38 of file debug.cpp.

Typedef Documentation

◆ StatKeyNameMap

typedef map<int,string> StatKeyNameMap

Definition at line 1417 of file debug.cpp.

◆ StatKeyNameMapConstIter

typedef StatKeyNameMap::const_iterator StatKeyNameMapConstIter

Definition at line 1420 of file debug.cpp.

◆ StatKeyNameMapIter

typedef StatKeyNameMap::iterator StatKeyNameMapIter

Definition at line 1419 of file debug.cpp.

◆ StatKeyNamePair

typedef pair<int,string> StatKeyNamePair

Definition at line 1418 of file debug.cpp.

Function Documentation

◆ AJAStatusToString()

std::string AJAStatusToString ( const AJAStatus  inStatus,
const bool  inDetailed = false 
)
Parameters
[in]inStatusThe AJAStatus value of interest.
[in]inDetailedOptionally specifies the type of string content to return. If false, the default, returns the literal enum (e.g. "AJA_STATUS_FAIL"). If true, returns a description (e.g. "Failed").
Returns
A string that contains the given AJAStatus value as human-readable text.

Definition at line 981 of file debug.cpp.

◆ debug_time()

int64_t debug_time ( void  )
inline

Definition at line 324 of file debug.cpp.

◆ gStatKeyToStrReady()

static bool gStatKeyToStrReady ( false  )
static

◆ InitStatKeyNames()

static void InitStatKeyNames ( void  )
static

Definition at line 1425 of file debug.cpp.

◆ operator<<()

std::ostream& operator<< ( std::ostream &  oss,
const AJADebugStat inStat 
)

Definition at line 1497 of file debug.cpp.

◆ report_common()

uint64_t report_common ( int32_t  index,
int32_t  severity,
const char *  pFileName,
int32_t  lineNumber,
uint64_t &  writeIndex,
int32_t &  messageIndex 
)
inline

Definition at line 333 of file debug.cpp.

Variable Documentation

◆ gStatKeyToStr

StatKeyNameMap gStatKeyToStr
static

Definition at line 1421 of file debug.cpp.

◆ gStatKeyToStrLock

AJALock gStatKeyToStrLock
static

Definition at line 1423 of file debug.cpp.

◆ sDebug

bool sDebug = false
static

Definition at line 33 of file debug.cpp.

◆ sGroupLabelVector

std::vector<std::string> sGroupLabelVector
static

Definition at line 29 of file debug.cpp.

◆ sLock

AJALock sLock
static

Definition at line 31 of file debug.cpp.

◆ spShare

AJADebugShare* spShare = NULL
static

Definition at line 32 of file debug.cpp.

◆ sSeverityString

const std::string sSeverityString[] = {"emergency", "alert", "assert", "error", "warning", "notice", "info", "debug"}
static

Definition at line 30 of file debug.cpp.