AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
debug.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
10 #include "ajabase/system/debug.h"
11 #include "ajabase/system/memory.h"
12 #include "ajabase/system/lock.h"
13 #include "ajabase/system/process.h"
14 #include "ajabase/system/system.h"
16 #include "ajabase/system/thread.h"
17 
18 #if defined(AJA_LINUX) || defined(AJA_BAREMETAL)
19  #include <stdarg.h>
20 #endif
21 #include <assert.h>
22 #include <string.h>
23 #include <stdio.h>
24 #include <time.h>
25 #include <iostream>
26 #include <iomanip>
27 #include <map>
28 
29 static std::vector<std::string> sGroupLabelVector;
30 static const std::string sSeverityString[] = {"emergency", "alert", "assert", "error", "warning", "notice", "info", "debug"};
31 static AJALock sLock;
33 static bool sDebug = false;
34 
35 #define addDebugGroupToLabelVector(x) sGroupLabelVector.push_back(#x)
36 
37 #define STAT_BIT_SHIFT (1ULL<<(inKey%64))
38 #define STAT_BIT_TEST (spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] & STAT_BIT_SHIFT)
39 #define IS_STAT_BAD !STAT_BIT_TEST
40 #define STAT_BIT_SET spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] |= STAT_BIT_SHIFT
41 #define STAT_BIT_CLEAR spShare->statAllocMask[inKey/(AJA_DEBUG_MAX_NUM_STATS/64)] &= 0xFFFFFFFFFFFFFFFF - STAT_BIT_SHIFT
42 
43 
44 AJAStatus AJADebug::Open (bool incrementRefCount)
45 {
46  if (!sLock.IsValid())
47  return AJA_STATUS_INITIALIZE;
48 
49  AJAAutoLock lock(&sLock);
50 
51  // set the debug flag
52  sDebug = false;
53 #if defined(AJA_DEBUG)
54  sDebug = true;
55 #endif
56 
57  try
58  {
59  // allocate the shared data structure for messages
60  if (!spShare)
61  {
62  // allocate the shared memory storage
63  size_t size (sizeof(AJADebugShare));
64  spShare = reinterpret_cast<AJADebugShare*>(AJAMemory::AllocateShared(&size, AJA_DEBUG_SHARE_NAME, false));
65  if (spShare == NULL || spShare == reinterpret_cast<void*>(-1))
66  {
67  spShare = NULL;
68  Close();
69  return AJA_STATUS_FAIL;
70  }
71 
72  if (size < (sizeof(AJADebugShare) - sizeof(AJADebugStat)*AJA_DEBUG_MAX_NUM_STATS))
73  { // Fail anything smaller than v110's size
74  Close();
75  return AJA_STATUS_FAIL;
76  }
77 
78  // check version
79  if (spShare->version == 0)
80  { // Initialize shared memory region...
81  ::memset(reinterpret_cast<void*>(spShare), 0, sizeof(AJADebugShare));
84  spShare->writeIndex = 0;
94  for (size_t num(0); num < size_t(AJA_DEBUG_MAX_NUM_STATS/64); num++)
95  spShare->statAllocMask[num] = 0;
97  }
98 
99  // shared data must be the correct version
101  {
102  Close();
103  return AJA_STATUS_FAIL;
104  }
105 
106  if (incrementRefCount)
107  {
108  // increment reference count;
110  }
111 
112  // Create the Unit Label Vector
113  sGroupLabelVector.clear();
175 
176  for (int i(AJA_DebugUnit_FirstUnused); i < AJA_DebugUnit_Size; i++)
177  {
178  std::string name("AJA_DebugUnit_Unused_");
179  name += aja::to_string(i);
180  sGroupLabelVector.push_back(name);
181  }
182 
183  assert(sGroupLabelVector.size() == AJA_DebugUnit_Size);
184  }
185  }
186  catch(...)
187  {
188  Close();
189  return AJA_STATUS_FAIL;
190  }
191 
192  return AJA_STATUS_SUCCESS;
193 }
194 
195 
196 AJAStatus AJADebug::Close (bool decrementRefCount)
197 {
198  AJAAutoLock lock(&sLock);
199  try
200  {
201  if (spShare)
202  {
203  if (decrementRefCount)
204  {
205  spShare->clientRefCount--; // decrement reference count
206  if (spShare->clientRefCount <= 0)
207  spShare->clientRefCount = 0;
208  }
209 
210  // free the shared data structure
211  if (spShare)
213  }
214  }
215  catch(...)
216  {
217  }
218  spShare = NULL;
219  return AJA_STATUS_SUCCESS;
220 }
221 
222 
223 AJAStatus AJADebug::Enable (int32_t index, uint32_t destination)
224 {
225  uint32_t currentDestination = 0;
226  AJAStatus status = GetDestination(index, &currentDestination);
227  if (status != AJA_STATUS_SUCCESS)
228  return status;
229  return SetDestination(index, currentDestination | destination);
230 }
231 
232 
233 AJAStatus AJADebug::Disable (int32_t index, uint32_t destination)
234 {
235  uint32_t currentDestination = 0;
236  AJAStatus status = GetDestination(index, &currentDestination);
237  if (status != AJA_STATUS_SUCCESS)
238  return status;
239  return SetDestination(index, currentDestination & ~destination);
240 }
241 
242 
243 AJAStatus AJADebug::SetDestination (int32_t index, uint32_t destination)
244 {
245  if (!spShare)
246  return AJA_STATUS_INITIALIZE; // Not open
247  if (index < 0 || index >= AJA_DEBUG_UNIT_ARRAY_SIZE)
248  return AJA_STATUS_RANGE; // Bad index
249  try
250  { // save the destination
251  spShare->unitArray[index] = destination;
252  }
253  catch(...)
254  {
255  return AJA_STATUS_FAIL;
256  }
257  return AJA_STATUS_SUCCESS;
258 }
259 
260 
261 AJAStatus AJADebug::GetDestination (const int32_t index, uint32_t & outDestination)
262 {
263  if (!spShare)
264  return AJA_STATUS_INITIALIZE;
265  if (index < 0 || index >= AJA_DEBUG_UNIT_ARRAY_SIZE)
266  return AJA_STATUS_RANGE;
267  try
268  {
269  outDestination = spShare->unitArray[index];
270  }
271  catch(...)
272  {
273  return AJA_STATUS_FAIL;
274  }
275  return AJA_STATUS_SUCCESS;
276 }
277 
278 
279 bool AJADebug::IsActive (int32_t index)
280 {
281  if (!spShare)
282  return false; // Not open
283  if (index < 0 || index >= AJA_DEBUG_UNIT_ARRAY_SIZE)
284  return false; // Bad index
285  try
286  { // if no destination return false
288  return false;
289  }
290  catch(...)
291  {
292  return false;
293  }
294  return true;
295 }
296 
297 uint32_t AJADebug::Version (void)
298 {
299  if (!spShare)
300  return 0; // Not open
301  return spShare->version;
302 }
303 
304 uint32_t AJADebug::TotalBytes (void)
305 {
306  if (!spShare)
307  return 0; // Not open
308  if (HasStats())
309  return uint32_t(sizeof(AJADebugShare));
310  return uint32_t(sizeof(AJADebugShare)) - AJA_DEBUG_MAX_NUM_STATS * uint32_t(sizeof(AJADebugStat));
311 }
312 
313 bool AJADebug::IsOpen (void)
314 {
315  return spShare != NULL;
316 }
317 
318 
320 {
321  return sDebug;
322 }
323 
324 inline int64_t debug_time (void)
325 {
326  int64_t ticks = AJATime::GetSystemCounter();
327  int64_t rate = AJATime::GetSystemFrequency();
328  int64_t time = ticks / rate * AJA_DEBUG_TICK_RATE;
329  time += (ticks % rate) * AJA_DEBUG_TICK_RATE / rate;
330  return time;
331 }
332 
333 inline uint64_t report_common(int32_t index, int32_t severity, const char* pFileName, int32_t lineNumber, uint64_t& writeIndex, int32_t& messageIndex)
334 {
335  static const char * spUnknown = "unknown";
336  if (!spShare)
337  return false;
338 
339  // check for active client to receive messages
340  if (spShare->clientRefCount <= 0)
341  {
342  // nobody is listening so bail quickly
343  return false;
344  }
345 
346  // check for valid index
347  if ((index < 0) || (index >= AJA_DEBUG_UNIT_ARRAY_SIZE))
348  {
349  index = AJA_DebugUnit_Unknown;
350  }
351  // check for destination
353  {
355  return false;
356  }
357 
358  // check for valid severity
359  if ((severity < 0) || (severity >= AJA_DebugSeverity_Size))
360  {
361  severity = AJA_DebugSeverity_Warning;
362  }
363 
364  // check for valid file name
365  if (!pFileName)
366  pFileName = spUnknown;
367 
368  // increment the message write index
369  writeIndex = AJAAtomic::Increment(&spShare->writeIndex);
370 
371  // modulo the ring size to determine the message array index
372  messageIndex = writeIndex % AJA_DEBUG_MESSAGE_RING_SIZE;
373 
374  // save the message data
375  spShare->messageRing[messageIndex].groupIndex = index;
376  spShare->messageRing[messageIndex].destinationMask = spShare->unitArray[index];
377  spShare->messageRing[messageIndex].time = debug_time();
378  spShare->messageRing[messageIndex].wallTime = (int64_t)time(NULL);
379  aja::safer_strncpy(spShare->messageRing[messageIndex].fileName, pFileName, strlen(pFileName), AJA_DEBUG_FILE_NAME_MAX_SIZE);
380  spShare->messageRing[messageIndex].lineNumber = lineNumber;
381  spShare->messageRing[messageIndex].severity = severity;
382  spShare->messageRing[messageIndex].pid = AJAProcess::GetPid();
383  spShare->messageRing[messageIndex].tid = AJAThread::GetThreadId();
384 
385  return true;
386 }
387 
388 
389 void AJADebug::Report (int32_t index, int32_t severity, const char* pFileName, int32_t lineNumber, ...)
390 {
391  if (!spShare)
392  return; // Not open
393  try
394  {
395  uint64_t writeIndex = 0;
396  int32_t messageIndex = 0;
397  if (report_common(index, severity, pFileName, lineNumber, writeIndex, messageIndex))
398  {
399  // format the message
400  va_list vargs;
401  va_start(vargs, lineNumber);
402  const char* pFormat = va_arg(vargs, const char*);
403  // check for valid message
404  if (pFormat == NULL)
405  {
406  pFormat = (char*) "no message";
407  }
408  ajavsnprintf(spShare->messageRing[messageIndex].messageText,
410  pFormat, vargs);
411  va_end(vargs);
412 
413  // set last to indicate message complete
414  AJAAtomic::Exchange(&spShare->messageRing[messageIndex].sequenceNumber, writeIndex);
416  }
417  }
418  catch (...)
419  {
420  }
421 }
422 
423 
424 void AJADebug::Report (int32_t index, int32_t severity, const char* pFileName, int32_t lineNumber, const std::string& message)
425 {
426  if (!spShare)
427  return; // Not open
428  try
429  {
430  uint64_t writeIndex = 0;
431  int32_t messageIndex = 0;
432  if (report_common(index, severity, pFileName, lineNumber, writeIndex, messageIndex))
433  {
434  // copy the message
435  aja::safer_strncpy(spShare->messageRing[messageIndex].messageText, message.c_str(), message.length()+1, AJA_DEBUG_MESSAGE_MAX_SIZE);
436 
437  // set last to indicate message complete
438  AJAAtomic::Exchange(&spShare->messageRing[messageIndex].sequenceNumber, writeIndex);
440  }
441  }
442  catch (...)
443  {
444  }
445 }
446 
447 void AJADebug::AssertWithMessage (const char* pFileName, int32_t lineNumber, const std::string& pExpression)
448 {
449 #if defined(AJA_DEBUG)
450  // check for open
451  if (!spShare)
452  assert(false);
453 
454  try
455  {
456  // check for active client to receive messages
457  if (spShare->clientRefCount > 0)
458  {
459  // check for valid file name
460  if (pFileName == NULL)
461  {
462  pFileName = (char*) "unknown";
463  }
464 
465  // increment the message write index
466  uint64_t writeIndex = AJAAtomic::Increment(&spShare->writeIndex);
467 
468  // modulo the ring size to determine the message array index
469  int32_t messageIndex = writeIndex % AJA_DEBUG_MESSAGE_RING_SIZE;
470 
471  // save the message data
474  spShare->messageRing[messageIndex].time = debug_time();
475  spShare->messageRing[messageIndex].wallTime = (int64_t)time(NULL);
476  aja::safer_strncpy(spShare->messageRing[messageIndex].fileName, pFileName, strlen(pFileName), AJA_DEBUG_FILE_NAME_MAX_SIZE);
477  spShare->messageRing[messageIndex].lineNumber = lineNumber;
479  spShare->messageRing[messageIndex].pid = AJAProcess::GetPid();
480  spShare->messageRing[messageIndex].tid = AJAThread::GetThreadId();
481 
482  // format the message
483  ajasnprintf(spShare->messageRing[messageIndex].messageText,
485  "assertion failed (file %s, line %d): %s\n",
486  pFileName, lineNumber, pExpression.c_str());
487 
488  // set last to indicate message complete
489  AJAAtomic::Exchange(&spShare->messageRing[messageIndex].sequenceNumber, writeIndex);
491  }
492  }
493  catch (...)
494  {
495  }
496 
497  assert(false);
498 #else
499  AJA_UNUSED(pFileName);
500  AJA_UNUSED(lineNumber);
501  AJA_UNUSED(pExpression);
502 #endif
503 }
504 
505 
507 {
508  if (!spShare)
509  return 0;
511 }
512 
513 
515 {
516  outRefCount = 0;
517  if (!spShare)
518  return AJA_STATUS_INITIALIZE;
519  try
520  {
521  outRefCount = spShare->clientRefCount;
522  }
523  catch(...)
524  {
525  return AJA_STATUS_FAIL;
526  }
527  return AJA_STATUS_SUCCESS;
528 }
529 
530 
532 {
533  if (!spShare)
534  return AJA_STATUS_INITIALIZE;
535  try
536  {
537  spShare->clientRefCount = refCount;
538  if (refCount <= 0)
539  {
540  // this will handle shuting everything down if ref count goes to 0 or less
541  AJADebug::Close();
542  }
543  }
544  catch(...)
545  {
546  return AJA_STATUS_FAIL;
547  }
548  return AJA_STATUS_SUCCESS;
549 }
550 
551 
552 AJAStatus AJADebug::GetSequenceNumber (uint64_t & outSequenceNumber)
553 {
554  if (!spShare)
555  return AJA_STATUS_INITIALIZE;
556  try
557  {
558  outSequenceNumber = spShare->writeIndex;
559  }
560  catch(...)
561  {
562  return AJA_STATUS_FAIL;
563  }
564  return AJA_STATUS_SUCCESS;
565 }
566 
567 
568 AJAStatus AJADebug::GetMessageSequenceNumber (const uint64_t sequenceNumber, uint64_t & outSequenceNumber)
569 {
570  if (!spShare)
571  return AJA_STATUS_INITIALIZE;
572  if (sequenceNumber > spShare->writeIndex)
573  return AJA_STATUS_RANGE;
574  try
575  {
576  outSequenceNumber = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].sequenceNumber;
577  }
578  catch(...)
579  {
580  return AJA_STATUS_FAIL;
581  }
582  return AJA_STATUS_SUCCESS;
583 }
584 
585 
586 AJAStatus AJADebug::GetMessageGroup (const uint64_t sequenceNumber, int32_t & outGroupIndex)
587 {
588  if (!spShare)
589  return AJA_STATUS_INITIALIZE;
590  if (sequenceNumber > spShare->writeIndex)
591  return AJA_STATUS_RANGE;
592  try
593  {
594  outGroupIndex = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].groupIndex;
595  }
596  catch(...)
597  {
598  return AJA_STATUS_FAIL;
599  }
600  return AJA_STATUS_SUCCESS;
601 }
602 
603 
604 AJAStatus AJADebug::GetMessageDestination (const uint64_t sequenceNumber, uint32_t & outDestination)
605 {
606  if (!spShare)
607  return AJA_STATUS_INITIALIZE;
608  if (sequenceNumber > spShare->writeIndex)
609  return AJA_STATUS_RANGE;
610  try
611  {
612  outDestination = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].destinationMask;
613  }
614  catch(...)
615  {
616  return AJA_STATUS_FAIL;
617  }
618  return AJA_STATUS_SUCCESS;
619 }
620 
621 
622 AJAStatus AJADebug::GetMessageTime (const uint64_t sequenceNumber, uint64_t & outTime)
623 {
624  if (!spShare)
625  return AJA_STATUS_INITIALIZE;
626  if (sequenceNumber > spShare->writeIndex)
627  return AJA_STATUS_RANGE;
628  try
629  {
630  outTime = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].time;
631  }
632  catch(...)
633  {
634  return AJA_STATUS_FAIL;
635  }
636  return AJA_STATUS_SUCCESS;
637 }
638 
639 AJAStatus AJADebug::GetMessageWallClockTime (const uint64_t sequenceNumber, int64_t & outTime)
640 {
641  if (!spShare)
642  return AJA_STATUS_INITIALIZE;
643  if (sequenceNumber > spShare->writeIndex)
644  return AJA_STATUS_RANGE;
645  try
646  {
647  outTime = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].wallTime;
648  }
649  catch(...)
650  {
651  return AJA_STATUS_FAIL;
652  }
653  return AJA_STATUS_SUCCESS;
654 }
655 
656 AJAStatus AJADebug::GetMessageFileName (const uint64_t sequenceNumber, std::string & outFileName)
657 {
658  outFileName.clear();
659  if (!spShare)
660  return AJA_STATUS_INITIALIZE;
661  if (sequenceNumber > spShare->writeIndex)
662  return AJA_STATUS_RANGE;
663  try
664  {
665  outFileName = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].fileName;
666  }
667  catch(...)
668  {
669  return AJA_STATUS_FAIL;
670  }
671  return AJA_STATUS_SUCCESS;
672 }
673 
674 AJAStatus AJADebug::GetMessageFileName (uint64_t sequenceNumber, const char** ppFileName)
675 {
676  if (!spShare)
677  return AJA_STATUS_INITIALIZE;
678  if (sequenceNumber > spShare->writeIndex)
679  return AJA_STATUS_RANGE;
680  if (ppFileName == NULL)
681  return AJA_STATUS_NULL;
682  try
683  {
684  *ppFileName = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].fileName;
685  }
686  catch(...)
687  {
688  return AJA_STATUS_FAIL;
689  }
690  return AJA_STATUS_SUCCESS;
691 }
692 
693 
694 AJAStatus AJADebug::GetMessageLineNumber (const uint64_t sequenceNumber, int32_t & outLineNumber)
695 {
696  if (!spShare)
697  return AJA_STATUS_INITIALIZE;
698  if (sequenceNumber > spShare->writeIndex)
699  return AJA_STATUS_RANGE;
700  try
701  {
702  outLineNumber = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].lineNumber;
703  }
704  catch(...)
705  {
706  return AJA_STATUS_FAIL;
707  }
708  return AJA_STATUS_SUCCESS;
709 }
710 
711 
712 AJAStatus AJADebug::GetMessageSeverity (const uint64_t sequenceNumber, int32_t & outSeverity)
713 {
714  if (!spShare)
715  return AJA_STATUS_INITIALIZE;
716  if (sequenceNumber > spShare->writeIndex)
717  return AJA_STATUS_RANGE;
718  try
719  {
720  outSeverity = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].severity;
721  }
722  catch(...)
723  {
724  return AJA_STATUS_FAIL;
725  }
726  return AJA_STATUS_SUCCESS;
727 }
728 
729 
730 AJAStatus AJADebug::GetMessageText (const uint64_t sequenceNumber, std::string & outMessage)
731 {
732  outMessage.clear();
733  if (!spShare)
734  return AJA_STATUS_INITIALIZE;
735  if (sequenceNumber > spShare->writeIndex)
736  return AJA_STATUS_RANGE;
737  try
738  {
739  outMessage = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].messageText;
740  }
741  catch(...)
742  {
743  return AJA_STATUS_FAIL;
744  }
745  return AJA_STATUS_SUCCESS;
746 }
747 
748 AJAStatus AJADebug::GetMessageText (uint64_t sequenceNumber, const char** ppMessage)
749 {
750  if (!spShare)
751  return AJA_STATUS_INITIALIZE;
752  if (sequenceNumber > spShare->writeIndex)
753  return AJA_STATUS_RANGE;
754  if (!ppMessage)
755  return AJA_STATUS_NULL;
756  try
757  {
758  *ppMessage = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].messageText;
759  }
760  catch(...)
761  {
762  return AJA_STATUS_FAIL;
763  }
764  return AJA_STATUS_SUCCESS;
765 }
766 
767 
768 AJAStatus AJADebug::GetProcessId (const uint64_t sequenceNumber, uint64_t & outPid)
769 {
770  if (!spShare)
771  return AJA_STATUS_INITIALIZE;
772  if (sequenceNumber > spShare->writeIndex)
773  return AJA_STATUS_RANGE;
774  try
775  {
776  outPid = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].pid;
777  }
778  catch(...)
779  {
780  return AJA_STATUS_FAIL;
781  }
782  return AJA_STATUS_SUCCESS;
783 }
784 
785 
786 AJAStatus AJADebug::GetThreadId (const uint64_t sequenceNumber, uint64_t & outTid)
787 {
788  if (!spShare)
789  return AJA_STATUS_INITIALIZE;
790  if (sequenceNumber > spShare->writeIndex)
791  return AJA_STATUS_RANGE;
792  try
793  {
794  outTid = spShare->messageRing[sequenceNumber%AJA_DEBUG_MESSAGE_RING_SIZE].tid;
795  }
796  catch(...)
797  {
798  return AJA_STATUS_FAIL;
799  }
800  return AJA_STATUS_SUCCESS;
801 }
802 
803 
805 {
806  if (!spShare)
807  return AJA_STATUS_INITIALIZE;
808  try
809  {
810  outCount = spShare->statsMessagesAccepted;
811  }
812  catch(...)
813  {
814  return AJA_STATUS_FAIL;
815  }
816  return AJA_STATUS_SUCCESS;
817 }
818 
819 
821 {
822  if (!spShare)
823  return AJA_STATUS_INITIALIZE;
824  try
825  {
826  outCount = spShare->statsMessagesIgnored;
827  }
828  catch(...)
829  {
830  return AJA_STATUS_FAIL;
831  }
832  return AJA_STATUS_SUCCESS;
833 }
834 
835 
836 const char* AJADebug::GetSeverityString (int32_t severity)
837 {
838  if (severity < 0 || severity > 7)
839  return "severity range error";
840  return sSeverityString[severity].c_str();
841 }
842 
843 const std::string & AJADebug::SeverityName (const int32_t severity)
844 { static const std::string emptystr;
845  if (severity < 0 || severity > 7)
846  return emptystr;
847  return sSeverityString[severity];
848 }
849 
850 
851 const char* AJADebug::GetGroupString (int32_t group)
852 {
853  if (group < 0 || group >= int32_t(sGroupLabelVector.size()))
854  return "index range error";
855  if (sGroupLabelVector.at(size_t(group)).empty())
856  return "no label";
857  return sGroupLabelVector.at(size_t(group)).c_str();
858 }
859 
860 
861 const std::string & AJADebug::GroupName (const int32_t group)
862 {
863  static const std::string sRangeErr("<bad index>");
864  static const std::string sNoLabelErr("<empty>");
865  if (group < 0 || group >= int32_t(sGroupLabelVector.size()))
866  return sRangeErr;
867  if (sGroupLabelVector.at(size_t(group)).empty())
868  return sNoLabelErr;
869  return sGroupLabelVector.at(size_t(group));
870 }
871 
872 
873 AJAStatus AJADebug::SaveState (const std::string & inFilePath)
874 {
875  FILE* pFile(0);
876  if (!spShare)
877  return AJA_STATUS_INITIALIZE;
878 
879  // open a new state file
880  pFile = ::fopen(inFilePath.c_str(), "w");
881  if (!pFile)
882  return AJA_STATUS_FAIL;
883 
884  try
885  { // write the header
886  fprintf(pFile, "AJADebugVersion: %d\n", spShare->version);
887  fprintf(pFile, "AJADebugStateFileVersion: %d\n", AJA_DEBUG_STATE_FILE_VERSION);
888  for (int i = 0; i < AJA_DEBUG_UNIT_ARRAY_SIZE; i++)
889  {
890  // write groups with destinations enabled
891  if (spShare->unitArray[i])
892  {
893  if (i < AJA_DebugUnit_Size)
894  fprintf(pFile, "GroupDestination: %6d : %08x\n", i, spShare->unitArray[i]);
895  else
896  fprintf(pFile, "CustomGroupDestination: %6d : %08x\n", i, spShare->unitArray[i]);
897  }
898  }
899  }
900  catch(...)
901  {
902  return AJA_STATUS_FAIL;
903  }
904  fclose(pFile);
905  return AJA_STATUS_SUCCESS;
906 }
907 
908 
909 AJAStatus AJADebug::RestoreState (const std::string & inFilePath)
910 {
911  FILE* pFile(0);
912  if (!spShare)
913  return AJA_STATUS_INITIALIZE;
914 
915  // open existing file
916  pFile = ::fopen(inFilePath.c_str(), "r");
917  if (!pFile)
918  return AJA_STATUS_FAIL;
919 
920  try
921  {
922  int32_t count;
923  uint32_t version;
924  int32_t index;
925  uint32_t destination;
926  int intVersion;
927 
928  // read the header
929  count = fscanf(pFile, " AJADebugVersion: %d", &intVersion);
930  version = intVersion;
931  if((count != 1) || (version != spShare->version))
932  {
933  fclose(pFile);
934  return AJA_STATUS_FAIL;
935  }
936  count = fscanf(pFile, " AJADebugStateFileVersion: %d", &intVersion);
937  version = intVersion;
938  if((count != 1) || (version != AJA_DEBUG_STATE_FILE_VERSION))
939  {
940  fclose(pFile);
941  return AJA_STATUS_FAIL;
942  }
943 
944  while(true)
945  {
946  // read groups that have destinations
947  count = fscanf(pFile, " GroupDestination: %d : %x", &index, &destination);
948  if (count != 2)
949  {
950  count = fscanf(pFile, " CustomGroupDestination: %d : %x", &index, &destination);
951  if (count != 2)
952  break;
953  }
954 
955  // index must be in range
956  if ((index < 0) || (index >= AJA_DEBUG_UNIT_ARRAY_SIZE))
957  continue;
958 
959  // update the destination
960  spShare->unitArray[index] = destination;
961  }
962  }
963  catch(...)
964  {
965  ::fclose(pFile);
966  return AJA_STATUS_FAIL;
967  }
968 
969  ::fclose(pFile);
970  return AJA_STATUS_SUCCESS;
971 }
972 
973 
974 int64_t AJADebug::DebugTime (void)
975 {
976  // wrapper around the inlined local version
977  return debug_time();
978 }
979 
980 
981 std::string AJAStatusToString (const AJAStatus inStatus, const bool inDetailed)
982 {
983  switch (inStatus)
984  {
985  case AJA_STATUS_SUCCESS: return inDetailed ? "Success" : "AJA_STATUS_SUCCESS";
986  case AJA_STATUS_TRUE: return inDetailed ? "True" : "AJA_STATUS_TRUE";
987  case AJA_STATUS_UNKNOWN: return inDetailed ? "Unknown Error" : "AJA_STATUS_UNKNOWN";
988  case AJA_STATUS_FAIL: return inDetailed ? "Failed" : "AJA_STATUS_FAIL";
989  case AJA_STATUS_TIMEOUT: return inDetailed ? "Timed Out" : "AJA_STATUS_TIMEOUT";
990  case AJA_STATUS_RANGE: return inDetailed ? "Out Of Range" : "AJA_STATUS_RANGE";
991  case AJA_STATUS_INITIALIZE: return inDetailed ? "Initialize" : "AJA_STATUS_INITIALIZE";
992  case AJA_STATUS_NULL: return inDetailed ? "Null" : "AJA_STATUS_NULL";
993  case AJA_STATUS_OPEN: return inDetailed ? "Not Open" : "AJA_STATUS_OPEN";
994  case AJA_STATUS_IO: return inDetailed ? "I/O Error" : "AJA_STATUS_IO";
995  case AJA_STATUS_DISABLED: return inDetailed ? "Disabled" : "AJA_STATUS_DISABLED";
996  case AJA_STATUS_BUSY: return inDetailed ? "Busy" : "AJA_STATUS_BUSY";
997  case AJA_STATUS_BAD_PARAM: return inDetailed ? "Bad Param" : "AJA_STATUS_BAD_PARAM";
998  case AJA_STATUS_FEATURE: return inDetailed ? "Feature" : "AJA_STATUS_FEATURE";
999  case AJA_STATUS_UNSUPPORTED: return inDetailed ? "Unsupported" : "AJA_STATUS_UNSUPPORTED";
1000  case AJA_STATUS_READONLY: return inDetailed ? "Read-Only" : "AJA_STATUS_READONLY";
1001  case AJA_STATUS_WRITEONLY: return inDetailed ? "Write-Only" : "AJA_STATUS_WRITEONLY";
1002  case AJA_STATUS_MEMORY: return inDetailed ? "Out Of Memory" : "AJA_STATUS_MEMORY";
1003  case AJA_STATUS_ALIGN: return inDetailed ? "Misaligned" : "AJA_STATUS_ALIGN";
1004  case AJA_STATUS_FLUSH: return inDetailed ? "Flush" : "AJA_STATUS_FLUSH";
1005  case AJA_STATUS_NOINPUT: return inDetailed ? "No Input" : "AJA_STATUS_NOINPUT";
1006  case AJA_STATUS_SURPRISE_REMOVAL: return inDetailed ? "Surprise Removal" : "AJA_STATUS_SURPRISE_REMOVAL";
1007  case AJA_STATUS_NOT_FOUND: return inDetailed ? "Not Found" : "AJA_STATUS_NOT_FOUND";
1008  case AJA_STATUS_NOBUFFER: return inDetailed ? "No Buffer" : "AJA_STATUS_NOBUFFER";
1009  case AJA_STATUS_INVALID_TIME: return inDetailed ? "Invalid Time" : "AJA_STATUS_INVALID_TIME";
1010  case AJA_STATUS_NOSTREAM: return inDetailed ? "No Stream" : "AJA_STATUS_NOSTREAM";
1011  case AJA_STATUS_TIMEEXPIRED: return inDetailed ? "Time Expired" : "AJA_STATUS_TIMEEXPIRED";
1012  case AJA_STATUS_BADBUFFERCOUNT: return inDetailed ? "Bad Buffer Count" : "AJA_STATUS_BADBUFFERCOUNT";
1013  case AJA_STATUS_BADBUFFERSIZE: return inDetailed ? "Bad Buffer Size" : "AJA_STATUS_BADBUFFERSIZE";
1014  case AJA_STATUS_STREAMCONFLICT: return inDetailed ? "Stream Conflict" : "AJA_STATUS_STREAMCONFLICT";
1015  case AJA_STATUS_NOTINITIALIZED: return inDetailed ? "Uninitialized" : "AJA_STATUS_NOTINITIALIZED";
1016  case AJA_STATUS_STREAMRUNNING: return inDetailed ? "Stream Running" : "AJA_STATUS_STREAMRUNNING";
1017  case AJA_STATUS_REBOOT: return inDetailed ? "Reboot" : "AJA_STATUS_REBOOT";
1018  case AJA_STATUS_POWER_CYCLE: return inDetailed ? "Power Cycle" : "AJA_STATUS_POWER_CYCLE";
1019 #if !defined(_DEBUG)
1020  default: break;
1021 #endif
1022  }
1023  return "<bad AJAStatus>";
1024 }
1025 
1026 
1028 {
1029  if (!sLock.IsValid())
1030  return NULL;
1031  AJAAutoLock lock(&sLock);
1032  return spShare;
1033 }
1034 
1035 
1037 {
1038  if (!sLock.IsValid())
1039  return 0;
1040  AJAAutoLock lock(&sLock);
1041  return spShare ? sizeof(AJADebugShare) : 0;
1042 }
1043 
1044 
1046 {
1047  if (!spShare)
1048  return 0;
1049  return spShare->statCapacity;
1050 }
1051 
1053 {
1054  return StatsCapacity() ? true : false;
1055 }
1056 
1057 AJAStatus AJADebug::StatAllocate (const uint32_t inKey)
1058 {
1059  if (!spShare)
1060  return AJA_STATUS_INITIALIZE;
1061  if (inKey >= spShare->statCapacity)
1062  return AJA_STATUS_RANGE;
1063  try
1064  {
1065  if (STAT_BIT_TEST)
1066  return AJA_STATUS_FAIL;
1067  STAT_BIT_SET;
1069  return StatReset(inKey);
1070  }
1071  catch(...)
1072  {
1073  return AJA_STATUS_FAIL;
1074  }
1075  return AJA_STATUS_SUCCESS;
1076 }
1077 
1078 AJAStatus AJADebug::StatFree (const uint32_t inKey)
1079 {
1080  if (!spShare)
1081  return AJA_STATUS_INITIALIZE;
1082  if (inKey >= spShare->statCapacity)
1083  return AJA_STATUS_RANGE;
1084  try
1085  {
1086  if (IS_STAT_BAD)
1087  return AJA_STATUS_FAIL;
1088  StatReset(inKey);
1091  }
1092  catch(...)
1093  {
1094  return AJA_STATUS_FAIL;
1095  }
1096  return AJA_STATUS_SUCCESS;
1097 }
1098 
1099 bool AJADebug::StatIsAllocated (const uint32_t inKey)
1100 {
1101  if (!spShare)
1102  return false;
1103  if (inKey >= spShare->statCapacity)
1104  return false;
1105  try
1106  {
1107  return IS_STAT_BAD ? false : true;
1108  }
1109  catch(...)
1110  {
1111  return false;
1112  }
1113 }
1114 
1115 AJAStatus AJADebug::StatReset (const uint32_t inKey)
1116 {
1117  if (!spShare)
1118  return AJA_STATUS_INITIALIZE;
1119  if (inKey >= spShare->statCapacity)
1120  return AJA_STATUS_RANGE;
1121  try
1122  {
1123  if (IS_STAT_BAD)
1124  return AJA_STATUS_FAIL;
1125  AJADebugStat & stat(spShare->stats[inKey]);
1126  stat.Reset();
1127  }
1128  catch(...)
1129  {
1130  return AJA_STATUS_FAIL;
1131  }
1132  return AJA_STATUS_SUCCESS;
1133 }
1134 
1135 AJAStatus AJADebug::StatTimerStart (const uint32_t inKey)
1136 {
1137  if (!spShare)
1138  return AJA_STATUS_INITIALIZE;
1139  if (inKey >= spShare->statCapacity)
1140  return AJA_STATUS_RANGE;
1141  try
1142  {
1143  if (IS_STAT_BAD)
1144  return AJA_STATUS_FAIL;
1145  AJADebugStat & stat(spShare->stats[inKey]);
1146  stat.Start();
1147  }
1148  catch(...)
1149  {
1150  return AJA_STATUS_FAIL;
1151  }
1152  return AJA_STATUS_SUCCESS;
1153 }
1154 
1155 AJAStatus AJADebug::StatTimerStop (const uint32_t inKey)
1156 {
1157  if (!spShare)
1158  return AJA_STATUS_INITIALIZE;
1159  if (inKey >= spShare->statCapacity)
1160  return AJA_STATUS_RANGE;
1161  try
1162  {
1163  if (IS_STAT_BAD)
1164  return AJA_STATUS_FAIL;
1165  AJADebugStat & stat(spShare->stats[inKey]);
1166  stat.Stop();
1167  }
1168  catch(...)
1169  {
1170  return AJA_STATUS_FAIL;
1171  }
1172  return AJA_STATUS_SUCCESS;
1173 }
1174 
1175 #define HEX0N(__x__,__n__) std::hex << std::uppercase << std::setw(int(__n__)) << std::setfill('0') << (__x__) << std::dec << std::setfill(' ') << std::nouppercase
1176 
1177 AJAStatus AJADebug::StatCounterIncrement (const uint32_t inKey, const uint32_t inIncrement)
1178 {
1179  if (!spShare)
1180  return AJA_STATUS_INITIALIZE;
1181  if (inKey >= spShare->statCapacity)
1182  return AJA_STATUS_RANGE;
1183  try
1184  {
1185  if (IS_STAT_BAD)
1186  return AJA_STATUS_FAIL;
1187  AJADebugStat & stat(spShare->stats[inKey]);
1188  stat.IncrementCount(inIncrement);
1189 if (inKey == 11)
1190 { const uint32_t * pU32(&stat.fMin);
1191  for (size_t num(0); num < 16; num++)
1192  std::cerr << " " << HEX0N(*pU32++,8);
1193  std::cerr << std::endl;
1194 }
1195  }
1196  catch(...)
1197  {
1198  return AJA_STATUS_FAIL;
1199  }
1200  return AJA_STATUS_SUCCESS;
1201 }
1202 
1203 AJAStatus AJADebug::StatSetValue (const uint32_t inKey, const uint32_t inValue)
1204 {
1205  if (!spShare)
1206  return AJA_STATUS_INITIALIZE;
1207  if (inKey >= spShare->statCapacity)
1208  return AJA_STATUS_RANGE;
1209  try
1210  {
1211  if (IS_STAT_BAD)
1212  return AJA_STATUS_FAIL;
1213  AJADebugStat & stat(spShare->stats[inKey]);
1214  stat.SetValue(inValue);
1215  }
1216  catch(...)
1217  {
1218  return AJA_STATUS_FAIL;
1219  }
1220  return AJA_STATUS_SUCCESS;
1221 }
1222 
1223 AJAStatus AJADebug::StatGetInfo (const uint32_t inKey, AJADebugStat & outInfo)
1224 {
1225  if (!spShare)
1226  return AJA_STATUS_INITIALIZE;
1227  if (inKey >= spShare->statCapacity)
1228  return AJA_STATUS_RANGE;
1229  try
1230  {
1231  if (IS_STAT_BAD)
1232  return AJA_STATUS_FAIL;
1233  outInfo = spShare->stats[inKey];
1234  }
1235  catch(...)
1236  {
1237  return AJA_STATUS_FAIL;
1238  }
1239  return AJA_STATUS_SUCCESS;
1240 }
1241 
1242 AJAStatus AJADebug::StatGetKeys (std::vector<uint32_t> & outKeys, uint32_t & outSeqNum)
1243 {
1244  outKeys.clear();
1245  outSeqNum = 0;
1246  if (!spShare)
1247  return AJA_STATUS_INITIALIZE;
1248  if (!spShare->statCapacity)
1249  return AJA_STATUS_FEATURE;
1250  try
1251  {
1252  for (uint32_t inKey(0); inKey < spShare->statCapacity; inKey++)
1253  if (STAT_BIT_TEST)
1254  outKeys.push_back(inKey);
1255  outSeqNum = spShare->statAllocChanges;
1256  }
1257  catch(...)
1258  {
1259  return AJA_STATUS_FAIL;
1260  }
1261  return AJA_STATUS_SUCCESS;
1262 }
1263 
1264 AJAStatus AJADebug::StatGetKeys (std::set<uint32_t> & outKeys, uint32_t & outSeqNum)
1265 {
1266  outKeys.clear();
1267  outSeqNum = 0;
1268  if (!spShare)
1269  return AJA_STATUS_INITIALIZE;
1270  if (!spShare->statCapacity)
1271  return AJA_STATUS_FEATURE;
1272  try
1273  {
1274  for (uint32_t inKey(0); inKey < spShare->statCapacity; inKey++)
1275  if (STAT_BIT_TEST)
1276  outKeys.insert(inKey);
1277  outSeqNum = spShare->statAllocChanges;
1278  }
1279  catch(...)
1280  {
1281  return AJA_STATUS_FAIL;
1282  }
1283  return AJA_STATUS_SUCCESS;
1284 }
1285 
1287 {
1288  outSeqNum = 0;
1289  if (!spShare)
1290  return AJA_STATUS_INITIALIZE;
1291  if (!spShare->statCapacity)
1292  return AJA_STATUS_FEATURE;
1293  outSeqNum = spShare->statAllocChanges;
1294  return AJA_STATUS_SUCCESS;
1295 }
1296 
1297 uint64_t AJADebugStat::Sum (size_t inNum) const
1298 {
1299  uint64_t result(0);
1300  if (!inNum)
1301  return result;
1302  if (inNum > AJA_DEBUG_STAT_DEQUE_SIZE)
1303  inNum = AJA_DEBUG_STAT_DEQUE_SIZE;
1304  for (size_t n(0); n < inNum; n++)
1305  result += fValues[n];
1306  return result;
1307 }
1308 
1309 uint32_t AJADebugStat::Minimum (size_t inNum) const
1310 {
1311  uint32_t result(0xFFFFFFFF);
1312  if (!inNum)
1313  return result;
1314  if (inNum > AJA_DEBUG_STAT_DEQUE_SIZE)
1315  inNum = AJA_DEBUG_STAT_DEQUE_SIZE;
1316  for (size_t n(0); n < inNum; n++)
1317  if (fValues[n] < result)
1318  result = fValues[n];
1319  return result;
1320 }
1321 
1322 uint32_t AJADebugStat::Maximum (size_t inNum) const
1323 {
1324  uint32_t result(0);
1325  if (!inNum)
1326  return result;
1327  if (inNum > AJA_DEBUG_STAT_DEQUE_SIZE)
1328  inNum = AJA_DEBUG_STAT_DEQUE_SIZE;
1329  for (size_t n(0); n < inNum; n++)
1330  if (fValues[n] > result)
1331  result = fValues[n];
1332  return result;
1333 }
1334 
1335 double AJADebugStat::Average(void) const
1336 {
1337  if (!fCount)
1338  return 0.00;
1339  if (fCount < 2)
1340  return double(fValues[0]);
1342 }
1343 
1345 {
1347 }
1348 
1350 {
1351  if (!fLastTimeStamp)
1352  return false; // Never started
1353  const uint64_t now(AJATime::GetSystemMicroseconds());
1354  if (now <= fLastTimeStamp)
1355  return false; // Should never happen
1356  SetValue(uint32_t(now - fLastTimeStamp));
1357  return true;
1358 }
1359 
1360 bool AJADebugStat::IncrementCount (uint32_t inIncrement, const bool inRollOver)
1361 {
1362  if (!inIncrement)
1363  return false; // Increment value must be non-zero
1364  if (!inRollOver && fCount == 0xFFFFFFFF)
1365  return false; // At rollover point, but not allowed
1366 
1367  while (inIncrement--)
1370  return true;
1371 }
1372 
1373 bool AJADebugStat::DecrementCount (uint32_t inDecrement, const bool inRollUnder)
1374 {
1375  if (!inDecrement)
1376  return false; // Decrement value must be non-zero
1377  if (!inRollUnder && !fCount)
1378  return false; // At rollunder point, but not allowed
1379 
1380  while (inDecrement--)
1383  return true;
1384 }
1385 
1386 void AJADebugStat::SetValue (const uint32_t inValue)
1387 {
1389  if (inValue < fMin)
1390  fMin = inValue;
1391  if (inValue > fMax)
1392  fMax = inValue;
1393  IncrementCount();
1394 }
1395 
1396 bool AJADebugStat::operator == (const AJADebugStat & inRHS) const
1397 {
1398  if (this == &inRHS)
1399  return true; // Same object, identical
1400  if (fCount != inRHS.fCount)
1401  return false;
1402  if (fLastTimeStamp != inRHS.fLastTimeStamp)
1403  return false;
1404  for (size_t n(0); n < AJA_DEBUG_STAT_DEQUE_SIZE; n++)
1405  if (fValues[n] != inRHS.fValues[n])
1406  return false;
1407  if (fMin != inRHS.fMin)
1408  return false;
1409  if (fMax != inRHS.fMax)
1410  return false;
1411  return true;
1412 }
1413 
1414 using namespace std;
1415 
1416 // Dictionary of Well-Known Stats:
1417 typedef map<int,string> StatKeyNameMap;
1418 typedef pair<int,string> StatKeyNamePair;
1419 typedef StatKeyNameMap::iterator StatKeyNameMapIter;
1420 typedef StatKeyNameMap::const_iterator StatKeyNameMapConstIter;
1422 static bool gStatKeyToStrReady(false);
1424 
1425 static void InitStatKeyNames (void)
1426 {
1451  gStatKeyToStr[AJA_DebugStat_ACXferRPCEncode] = "ACXferRPCEnc";
1452  gStatKeyToStr[AJA_DebugStat_ACXferRPCDecode] = "ACXferRPCDec";
1453  gStatKeyToStrReady = true;
1454  assert(gStatKeyToStr.size() == size_t(AJA_DebugStat_NUM_STATS)); // Be sure all are here
1455 }
1456 
1457 string AJADebugStat::StatKeyName (const int inKey)
1458 {
1460  if (!gStatKeyToStrReady)
1461  InitStatKeyNames();
1462  const StatKeyNameMapConstIter it(gStatKeyToStr.find(inKey));
1463  return it != gStatKeyToStr.end() ? it->second : string();
1464 }
1465 
1466 bool AJADebugStat::SetStatKeyName (const int inKey, const string & inName)
1467 {
1469  if (!gStatKeyToStrReady)
1470  InitStatKeyNames();
1471 
1472  const StatKeyNameMapIter it(gStatKeyToStr.find(inKey));
1473  if (inName.empty()) // Empty name === remove the defined name
1474  {
1475  if (it != gStatKeyToStr.end())
1476  gStatKeyToStr.erase(it);
1477  return true;
1478  }
1479  if (it != gStatKeyToStr.end())
1480  it->second = inName; // Replace existing name
1481  else
1482  gStatKeyToStr.insert(StatKeyNamePair(inKey, inName));
1483  return true;
1484 }
1485 
1487 {
1488  vector<int> result;
1490  if (!gStatKeyToStrReady)
1491  InitStatKeyNames();
1492  for (StatKeyNameMapConstIter it(gStatKeyToStr.begin()); it != gStatKeyToStr.end(); ++it)
1493  result.push_back(it->first);
1494  return result;
1495 }
1496 
1497 std::ostream & operator << (std::ostream & oss, const AJADebugStat & inStat)
1498 {
1499  oss << inStat.fMin << " (min), " << inStat.Average() << " (avg), " << inStat.fMax << " (max), " << inStat.fCount << " (cnt), " << inStat.fLastTimeStamp;
1500  return oss;
1501 }
AJADebug::GetClientReferenceCount
static AJAStatus GetClientReferenceCount(int32_t &outRefCount)
Definition: debug.cpp:514
AJA_DebugStat_GetInterruptCount
@ AJA_DebugStat_GetInterruptCount
Definition: debugshare.h:240
sDebug
static bool sDebug
Definition: debug.cpp:33
AJA_STATUS_BADBUFFERSIZE
@ AJA_STATUS_BADBUFFERSIZE
Definition: types.h:411
AJA_DebugStat_DMATransferEx
@ AJA_DebugStat_DMATransferEx
Definition: debugshare.h:242
AJADebug::SaveState
static AJAStatus SaveState(const std::string &inFilePath)
Definition: debug.cpp:873
AJADebug::GetMessageFileName
static AJAStatus GetMessageFileName(const uint64_t sequenceNumber, std::string &outFileName)
Definition: debug.cpp:656
AJADebug::StatReset
static AJAStatus StatReset(const uint32_t inKey)
Definition: debug.cpp:1115
AJA_DebugUnit_Cables
@ AJA_DebugUnit_Cables
Definition: debugshare.h:101
AJADebugStat::fCount
uint32_t volatile fCount
Definition: debugshare.h:267
AJADebug::StatTimerStop
static AJAStatus StatTimerStop(const uint32_t inKey)
Definition: debug.cpp:1155
AJADebug::GetDestination
static AJAStatus GetDestination(const int32_t inGroup, uint32_t &outDestination)
Definition: debug.cpp:261
AJA_DEBUG_SHARE_NAME
#define AJA_DEBUG_SHARE_NAME
Definition: debugshare.h:188
AJA_DebugUnit_StatsGeneric
@ AJA_DebugUnit_StatsGeneric
Definition: debugshare.h:56
AJADebugStat::DecrementCount
bool DecrementCount(const uint32_t inDecrement=1, const bool inRollUnder=true)
Definition: debug.cpp:1373
AJA_DebugUnit_AudioGeneric
@ AJA_DebugUnit_AudioGeneric
Definition: debugshare.h:52
spShare
static AJADebugShare * spShare
Definition: debug.cpp:32
AJADebug::GetMessageGroup
static AJAStatus GetMessageGroup(const uint64_t sequenceNumber, int32_t &outGroupIndex)
Definition: debug.cpp:586
report_common
uint64_t report_common(int32_t index, int32_t severity, const char *pFileName, int32_t lineNumber, uint64_t &writeIndex, int32_t &messageIndex)
Definition: debug.cpp:333
AJA_DebugSeverity_Size
@ AJA_DebugSeverity_Size
Definition: debugshare.h:33
AJA_DebugUnit_SMPTEAnc
@ AJA_DebugUnit_SMPTEAnc
Definition: debugshare.h:77
AJA_DebugUnit_FirstUnused
@ AJA_DebugUnit_FirstUnused
Definition: debugshare.h:125
_AJADebugShare::statsMessagesAccepted
uint64_t volatile statsMessagesAccepted
Definition: debugshare.h:338
AJA_DebugSeverity_Assert
@ AJA_DebugSeverity_Assert
Definition: debugshare.h:27
sSeverityString
static const std::string sSeverityString[]
Definition: debug.cpp:30
AJA_DebugUnit_CC608DecodeScreen
@ AJA_DebugUnit_CC608DecodeScreen
Definition: debugshare.h:69
StatKeyNameMapIter
StatKeyNameMap::iterator StatKeyNameMapIter
Definition: debug.cpp:1419
gStatKeyToStr
static StatKeyNameMap gStatKeyToStr
Definition: debug.cpp:1421
AJA_DebugSeverity_Warning
@ AJA_DebugSeverity_Warning
Definition: debugshare.h:29
AJA_DebugStat_HEVCSendMessage
@ AJA_DebugStat_HEVCSendMessage
Definition: debugshare.h:247
AJA_DebugUnit_App_User2
@ AJA_DebugUnit_App_User2
Definition: debugshare.h:94
NULL
#define NULL
Definition: ntv2caption608types.h:19
AJA_DebugStat_ReadRegister
@ AJA_DebugStat_ReadRegister
Definition: debugshare.h:224
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:381
AJA_DebugStat_NTV2Message
@ AJA_DebugStat_NTV2Message
Definition: debugshare.h:246
AJA_STATUS_NOT_FOUND
@ AJA_STATUS_NOT_FOUND
Definition: types.h:402
AJADebug::StatTimerStart
static AJAStatus StatTimerStart(const uint32_t inKey)
Definition: debug.cpp:1135
AJADebugStat::fMin
uint32_t fMin
Definition: debugshare.h:265
AJALock::IsValid
virtual bool IsValid(void) const
Definition: lock.h:67
AJADebugStat::StatKeyName
static std::string StatKeyName(const int inKey)
Definition: debug.cpp:1457
_AJADebugMessage::time
int64_t time
Definition: debugshare.h:204
AJA_DebugStat_AutoCirculate
@ AJA_DebugStat_AutoCirculate
Definition: debugshare.h:244
AJA_DebugStat_WaitForInterruptOthers
@ AJA_DebugStat_WaitForInterruptOthers
Definition: debugshare.h:239
systemtime.h
Declares the AJATime class.
AJA_STATUS_POWER_CYCLE
@ AJA_STATUS_POWER_CYCLE
Definition: types.h:418
AJA_DebugUnit_ControlPanel
@ AJA_DebugUnit_ControlPanel
Definition: debugshare.h:60
AJADebug::GetSequenceNumber
static AJAStatus GetSequenceNumber(uint64_t &outSequenceNumber)
Definition: debug.cpp:552
AJA_STATUS_TRUE
@ AJA_STATUS_TRUE
Definition: types.h:380
AJA_DebugStat_WaitForInterruptIn2
@ AJA_DebugStat_WaitForInterruptIn2
Definition: debugshare.h:227
AJAThread::GetThreadId
static uint64_t GetThreadId()
Definition: thread.cpp:180
AJA_STATUS_BUSY
@ AJA_STATUS_BUSY
Definition: types.h:391
AJADebug::SetDestination
static AJAStatus SetDestination(int32_t index, uint32_t destination=AJA_DEBUG_DESTINATION_NONE)
Definition: debug.cpp:243
AJA_DebugUnit_Testing
@ AJA_DebugUnit_Testing
Definition: debugshare.h:80
AJADebugStat::fLastTimeStamp
uint64_t fLastTimeStamp
Definition: debugshare.h:268
AJADebugStat::SetStatKeyName
static bool SetStatKeyName(const int inKey, const std::string &inName)
Definition: debug.cpp:1466
STAT_BIT_CLEAR
#define STAT_BIT_CLEAR
Definition: debug.cpp:41
AJA_DebugUnit_App_Screen
@ AJA_DebugUnit_App_Screen
Definition: debugshare.h:92
STAT_BIT_TEST
#define STAT_BIT_TEST
Definition: debug.cpp:38
StatKeyNameMapConstIter
StatKeyNameMap::const_iterator StatKeyNameMapConstIter
Definition: debug.cpp:1420
AJA_DebugUnit_CSC
@ AJA_DebugUnit_CSC
Definition: debugshare.h:99
aja::safer_strncpy
char * safer_strncpy(char *target, const char *source, size_t num, size_t maxSize)
Definition: common.cpp:492
AJA_STATUS_MEMORY
@ AJA_STATUS_MEMORY
Definition: types.h:397
AJADebugStat::operator==
bool operator==(const AJADebugStat &inRHS) const
Definition: debug.cpp:1396
AJA_DebugUnit_CCFont
@ AJA_DebugUnit_CCFont
Definition: debugshare.h:76
StatKeyNamePair
pair< int, string > StatKeyNamePair
Definition: debug.cpp:1418
AJA_DebugUnit_AJAAncData
@ AJA_DebugUnit_AJAAncData
Definition: debugshare.h:78
AJA_DebugUnit_AJAAncList
@ AJA_DebugUnit_AJAAncList
Definition: debugshare.h:79
AJA_DebugUnit_Stream
@ AJA_DebugUnit_Stream
Definition: debugshare.h:106
AJA_UNUSED
#define AJA_UNUSED(_x_)
Definition: types.h:424
AJADebug::Enable
static AJAStatus Enable(int32_t index, uint32_t destination=AJA_DEBUG_DESTINATION_NONE)
Definition: debug.cpp:223
debug_time
int64_t debug_time(void)
Definition: debug.cpp:324
AJA_STATUS_NOBUFFER
@ AJA_STATUS_NOBUFFER
Definition: types.h:406
AJADebug::Report
static void Report(int32_t index, int32_t severity, const char *pFileName, int32_t lineNumber,...)
Definition: debug.cpp:389
_AJADebugShare
Definition: debugshare.h:326
AJA_DebugUnit_LUT
@ AJA_DebugUnit_LUT
Definition: debugshare.h:100
AJADebugShare
struct _AJADebugShare AJADebugShare
AJADebugStat::fValues
uint32_t fValues[11]
Definition: debugshare.h:269
AJATime::GetSystemMicroseconds
static uint64_t GetSystemMicroseconds(void)
Returns the current value of the host's high-resolution clock, in microseconds.
Definition: systemtime.cpp:221
AJA_DebugStat_WaitForInterruptIn8
@ AJA_DebugStat_WaitForInterruptIn8
Definition: debugshare.h:233
AJA_DebugUnit_DriverInterface
@ AJA_DebugUnit_DriverInterface
Definition: debugshare.h:84
_AJADebugShare::messageTextCapacity
uint32_t messageTextCapacity
Definition: debugshare.h:334
AJA_DebugStat_ACXferRPCDecode
@ AJA_DebugStat_ACXferRPCDecode
Definition: debugshare.h:249
AJA_STATUS_ALIGN
@ AJA_STATUS_ALIGN
Definition: types.h:398
AJA_DebugUnit_ServiceGeneric
@ AJA_DebugUnit_ServiceGeneric
Definition: debugshare.h:49
AJADebugStat::Maximum
uint32_t Maximum(size_t inNum=11) const
Definition: debug.cpp:1322
AJA_STATUS_STREAMCONFLICT
@ AJA_STATUS_STREAMCONFLICT
Definition: types.h:412
_AJADebugShare::magicId
uint32_t magicId
Definition: debugshare.h:328
_AJADebugShare::stats
AJADebugStat stats[256]
Definition: debugshare.h:347
AJA_DebugUnit_App_Decode
@ AJA_DebugUnit_App_Decode
Definition: debugshare.h:89
AJA_DebugStat_DMATransferP2P
@ AJA_DebugStat_DMATransferP2P
Definition: debugshare.h:243
AJA_STATUS_NOSTREAM
@ AJA_STATUS_NOSTREAM
Definition: types.h:408
AJADebug::GetMessageSeverity
static AJAStatus GetMessageSeverity(const uint64_t sequenceNumber, int32_t &outSeverity)
Definition: debug.cpp:712
AJA_STATUS_NOINPUT
@ AJA_STATUS_NOINPUT
Definition: types.h:400
AJAStatus
AJAStatus
Definition: types.h:378
AJA_STATUS_UNKNOWN
@ AJA_STATUS_UNKNOWN
Definition: types.h:383
process.h
Declares the AJAProcess class.
AJADebug::GroupName
static const std::string & GroupName(const int32_t group)
Definition: debug.cpp:861
AJAAtomic::Exchange
static void * Exchange(void *volatile *pTarget, void *pValue)
Definition: atomic.cpp:13
AJA_DebugStat_NUM_STATS
@ AJA_DebugStat_NUM_STATS
Definition: debugshare.h:250
AJA_DEBUG_MAX_NUM_STATS
#define AJA_DEBUG_MAX_NUM_STATS
Definition: debugshare.h:183
AJA_DebugUnit_Anc2110Xmit
@ AJA_DebugUnit_Anc2110Xmit
Definition: debugshare.h:95
AJA_DebugUnit_CC608DecodeChannel
@ AJA_DebugUnit_CC608DecodeChannel
Definition: debugshare.h:68
_AJADebugShare::writeIndex
uint64_t volatile writeIndex
Definition: debugshare.h:330
AJADebugStat::Stop
bool Stop(void)
Definition: debug.cpp:1349
AJA_DebugUnit_Persistence
@ AJA_DebugUnit_Persistence
Definition: debugshare.h:82
AJADebug::RestoreState
static AJAStatus RestoreState(const std::string &inFilePath)
Definition: debug.cpp:909
addDebugGroupToLabelVector
#define addDebugGroupToLabelVector(x)
Definition: debug.cpp:35
AJA_STATUS_FEATURE
@ AJA_STATUS_FEATURE
Definition: types.h:393
lock.h
Declares the AJALock class.
AJADebug::IsDebugBuild
static bool IsDebugBuild(void)
Definition: debug.cpp:319
AJA_STATUS_FAIL
@ AJA_STATUS_FAIL
Definition: types.h:382
AJA_DebugUnit_App_DiskWrite
@ AJA_DebugUnit_App_DiskWrite
Definition: debugshare.h:88
_AJADebugShare::messageRing
AJADebugMessage messageRing[4096]
Definition: debugshare.h:346
AJADebug::StatSetValue
static AJAStatus StatSetValue(const uint32_t inKey, const uint32_t inValue)
Definition: debug.cpp:1203
_AJADebugShare::messageRingCapacity
uint32_t messageRingCapacity
Definition: debugshare.h:333
AJADebug::GetSeverityString
static const char * GetSeverityString(int32_t severity)
Definition: debug.cpp:836
AJA_DebugStat_WaitForInterruptUartTx1
@ AJA_DebugStat_WaitForInterruptUartTx1
Definition: debugshare.h:236
AJADebug::GetPrivateDataLoc
static void * GetPrivateDataLoc(void)
Definition: debug.cpp:1027
AJADebugStat::IncrementCount
bool IncrementCount(const uint32_t inIncrement=1, const bool inRollOver=true)
Definition: debug.cpp:1360
AJADebug::GetGroupString
static const char * GetGroupString(int32_t group)
Definition: debug.cpp:851
AJADebug::IsActive
static bool IsActive(int32_t index)
Definition: debug.cpp:279
_AJADebugShare::unitArraySize
uint32_t unitArraySize
Definition: debugshare.h:336
AJA_DebugStat_AutoCirculateXfer
@ AJA_DebugStat_AutoCirculateXfer
Definition: debugshare.h:245
_AJADebugMessage::severity
int32_t severity
Definition: debugshare.h:208
AJADebug::Close
static AJAStatus Close(bool decrementRefCount=false)
Definition: debug.cpp:196
AJA_DebugUnit_RoutingGeneric
@ AJA_DebugUnit_RoutingGeneric
Definition: debugshare.h:55
AJAMemory::AllocateShared
static void * AllocateShared(size_t *size, const char *pShareName, bool global=true)
Definition: memory.cpp:169
AJA_STATUS_STREAMRUNNING
@ AJA_STATUS_STREAMRUNNING
Definition: types.h:414
AJA_DebugStat_WaitForInterruptUartTx2
@ AJA_DebugStat_WaitForInterruptUartTx2
Definition: debugshare.h:238
AJA_DebugUnit_DemoPlayout
@ AJA_DebugUnit_DemoPlayout
Definition: debugshare.h:97
AJADebugStat::SetValue
void SetValue(const uint32_t inValue)
Definition: debug.cpp:1386
AJAProcess::GetPid
static uint64_t GetPid()
Definition: process.cpp:35
AJADebug::GetMessagesAccepted
static AJAStatus GetMessagesAccepted(uint64_t &outCount)
Definition: debug.cpp:804
_AJADebugShare::clientRefCount
int32_t volatile clientRefCount
Definition: debugshare.h:331
AJA_DebugUnit_NMOS
@ AJA_DebugUnit_NMOS
Definition: debugshare.h:86
AJA_DebugUnit_Firmware
@ AJA_DebugUnit_Firmware
Definition: debugshare.h:104
AJADebug::GetMessageSequenceNumber
static AJAStatus GetMessageSequenceNumber(const uint64_t sequenceNumber, uint64_t &outSequenceNumber)
Definition: debug.cpp:568
AJA_STATUS_WRITEONLY
@ AJA_STATUS_WRITEONLY
Definition: types.h:396
InitStatKeyNames
static void InitStatKeyNames(void)
Definition: debug.cpp:1425
AJADebug::SetClientReferenceCount
static AJAStatus SetClientReferenceCount(int32_t refCount)
Definition: debug.cpp:531
IS_STAT_BAD
#define IS_STAT_BAD
Definition: debug.cpp:39
AJADebug::DebugTime
static int64_t DebugTime(void)
Definition: debug.cpp:974
gStatKeyToStrLock
static AJALock gStatKeyToStrLock
Definition: debug.cpp:1423
AJADebug::AssertWithMessage
static void AssertWithMessage(const char *pFileName, int32_t lineNumber, const std::string &pExpression)
Definition: debug.cpp:447
AJA_DebugUnit_App_DMA
@ AJA_DebugUnit_App_DMA
Definition: debugshare.h:91
_AJADebugMessage::fileName
char fileName[512]
Definition: debugshare.h:212
AJA_DebugUnit_PnP
@ AJA_DebugUnit_PnP
Definition: debugshare.h:81
AJA_DebugUnit_CC708Decode
@ AJA_DebugUnit_CC708Decode
Definition: debugshare.h:71
AJADebug::StatAllocate
static AJAStatus StatAllocate(const uint32_t inKey)
Definition: debug.cpp:1057
AJADebug::StatGetKeys
static AJAStatus StatGetKeys(std::vector< uint32_t > &outKeys, uint32_t &outSeqNum)
Definition: debug.cpp:1242
AJA_DEBUG_MAGIC_ID
#define AJA_DEBUG_MAGIC_ID
Definition: debugshare.h:179
AJADebug::GetThreadId
static AJAStatus GetThreadId(const uint64_t sequenceNumber, uint64_t &outTid)
Definition: debug.cpp:786
AJADebug::StatGetInfo
static AJAStatus StatGetInfo(const uint32_t inKey, AJADebugStat &outInfo)
Definition: debug.cpp:1223
AJA_DebugUnit_App_User1
@ AJA_DebugUnit_App_User1
Definition: debugshare.h:93
AJA_DEBUG_VERSION
#define AJA_DEBUG_VERSION
Definition: debugshare.h:180
AJAMemory::FreeShared
static void FreeShared(void *pMemory)
Definition: memory.cpp:366
_AJADebugShare::statsMessagesIgnored
uint64_t volatile statsMessagesIgnored
Definition: debugshare.h:339
_AJADebugShare::unitArray
uint32_t unitArray[65536]
Definition: debugshare.h:345
AJA_DEBUG_TICK_RATE
#define AJA_DEBUG_TICK_RATE
Definition: debugshare.h:189
AJA_DebugUnit_App_Encode
@ AJA_DebugUnit_App_Encode
Definition: debugshare.h:90
AJADebugStat::Average
double Average(void) const
Definition: debug.cpp:1335
AJA_DebugUnit_UserGeneric
@ AJA_DebugUnit_UserGeneric
Definition: debugshare.h:50
AJA_STATUS_UNSUPPORTED
@ AJA_STATUS_UNSUPPORTED
Definition: types.h:394
AJADebug::GetPrivateDataLen
static size_t GetPrivateDataLen(void)
Definition: debug.cpp:1036
AJALock
Definition: lock.h:30
AJA_STATUS_IO
@ AJA_STATUS_IO
Definition: types.h:389
AJA_STATUS_INVALID_TIME
@ AJA_STATUS_INVALID_TIME
Definition: types.h:407
AJA_STATUS_RANGE
@ AJA_STATUS_RANGE
Definition: types.h:385
AJA_DEBUG_DESTINATION_CONSOLE
#define AJA_DEBUG_DESTINATION_CONSOLE
Definition: debugshare.h:167
AJADebug::Open
static AJAStatus Open(bool incrementRefCount=false)
Definition: debug.cpp:44
AJA_DebugStat_WaitForInterruptUartRx2
@ AJA_DebugStat_WaitForInterruptUartRx2
Definition: debugshare.h:237
AJA_STATUS_REBOOT
@ AJA_STATUS_REBOOT
Definition: types.h:417
AJA_DebugUnit_App_Alloc
@ AJA_DebugUnit_App_Alloc
Definition: debugshare.h:105
AJADebug::StatCounterIncrement
static AJAStatus StatCounterIncrement(const uint32_t inKey, const uint32_t inIncrement=1)
Definition: debug.cpp:1177
AJADebug::StatsCapacity
static uint32_t StatsCapacity(void)
Definition: debug.cpp:1045
AJA_DebugUnit_Critical
@ AJA_DebugUnit_Critical
Definition: debugshare.h:47
AJAAutoLock
Definition: lock.h:91
AJA_DebugUnit_CCLine21Decode
@ AJA_DebugUnit_CCLine21Decode
Definition: debugshare.h:63
system.h
System specific functions.
AJA_DebugUnit_AncGeneric
@ AJA_DebugUnit_AncGeneric
Definition: debugshare.h:54
AJA_STATUS_TIMEOUT
@ AJA_STATUS_TIMEOUT
Definition: types.h:384
_AJADebugMessage::wallTime
int64_t wallTime
Definition: debugshare.h:205
_AJADebugMessage::sequenceNumber
uint64_t sequenceNumber
Definition: debugshare.h:203
AJA_DebugStat_WaitForInterruptIn7
@ AJA_DebugStat_WaitForInterruptIn7
Definition: debugshare.h:232
sGroupLabelVector
static std::vector< std::string > sGroupLabelVector
Definition: debug.cpp:29
AJADebugStat::Start
void Start(void)
Definition: debug.cpp:1344
AJAAtomic::Increment
static int32_t Increment(int32_t volatile *pTarget)
Definition: atomic.cpp:82
AJA_DebugUnit_CC608Encode
@ AJA_DebugUnit_CC608Encode
Definition: debugshare.h:70
AJA_DebugStat_WaitForInterruptIn6
@ AJA_DebugStat_WaitForInterruptIn6
Definition: debugshare.h:231
AJA_DebugUnit_Plugins
@ AJA_DebugUnit_Plugins
Definition: debugshare.h:62
AJA_STATUS_INITIALIZE
@ AJA_STATUS_INITIALIZE
Definition: types.h:386
_AJADebugShare::statAllocChanges
uint32_t volatile statAllocChanges
Definition: debugshare.h:342
AJA_DebugStat_WaitForInterruptUartRx1
@ AJA_DebugStat_WaitForInterruptUartRx1
Definition: debugshare.h:235
AJA_STATUS_NULL
@ AJA_STATUS_NULL
Definition: types.h:387
_AJADebugMessage::pid
uint64_t pid
Definition: debugshare.h:210
false
#define false
Definition: ntv2devicefeatures.h:25
_AJADebugMessage::messageText
char messageText[512]
Definition: debugshare.h:213
common.h
Private include file for all ajabase sources.
AJA_DebugUnit_CC608Decode
@ AJA_DebugUnit_CC608Decode
Definition: debugshare.h:67
AJADebug::GetMessageDestination
static AJAStatus GetMessageDestination(const uint64_t sequenceNumber, uint32_t &outDestination)
Definition: debug.cpp:604
AJADebug::SeverityName
static const std::string & SeverityName(const int32_t severity)
Definition: debug.cpp:843
AJA_STATUS_FLUSH
@ AJA_STATUS_FLUSH
Definition: types.h:399
AJA_DEBUG_STAT_DEQUE_SIZE
#define AJA_DEBUG_STAT_DEQUE_SIZE
Definition: debugshare.h:184
AJADebug::StatIsAllocated
static bool StatIsAllocated(const uint32_t inKey)
Definition: debug.cpp:1099
HEX0N
#define HEX0N(__x__, __n__)
Definition: debug.cpp:1175
AJADebug::Version
static uint32_t Version(void)
Definition: debug.cpp:297
AJA_DebugUnit_Enumeration
@ AJA_DebugUnit_Enumeration
Definition: debugshare.h:57
AJA_DebugUnit_CC608MsgQueue
@ AJA_DebugUnit_CC608MsgQueue
Definition: debugshare.h:66
AJA_DebugStat_WaitForInterruptOut1
@ AJA_DebugStat_WaitForInterruptOut1
Definition: debugshare.h:234
AJADebugStat::fMax
uint32_t fMax
Definition: debugshare.h:266
AJA_DebugUnit_Unknown
@ AJA_DebugUnit_Unknown
Definition: debugshare.h:46
AJA_DEBUG_UNIT_ARRAY_SIZE
#define AJA_DEBUG_UNIT_ARRAY_SIZE
Definition: debugshare.h:181
_AJADebugMessage::lineNumber
int32_t lineNumber
Definition: debugshare.h:209
AJA_STATUS_BAD_PARAM
@ AJA_STATUS_BAD_PARAM
Definition: types.h:392
AJA_DebugUnit_CC608DataQueue
@ AJA_DebugUnit_CC608DataQueue
Definition: debugshare.h:65
AJADebugStat::NamedStatKeys
static std::vector< int > NamedStatKeys(void)
Definition: debug.cpp:1486
AJA_STATUS_TIMEEXPIRED
@ AJA_STATUS_TIMEEXPIRED
Definition: types.h:409
std
Definition: json.hpp:5362
AJA_STATUS_READONLY
@ AJA_STATUS_READONLY
Definition: types.h:395
AJA_DebugUnit_Anc2110Rcv
@ AJA_DebugUnit_Anc2110Rcv
Definition: debugshare.h:96
AJAStatusToString
std::string AJAStatusToString(const AJAStatus inStatus, const bool inDetailed)
Definition: debug.cpp:981
AJADebugStat::Sum
uint64_t Sum(size_t inNum=11) const
Definition: debug.cpp:1297
sLock
static AJALock sLock
Definition: debug.cpp:31
_AJADebugShare::statAllocMask
uint64_t statAllocMask[256/64]
Definition: debugshare.h:343
AJA_DebugUnit_CC708Encode
@ AJA_DebugUnit_CC708Encode
Definition: debugshare.h:75
AJA_DebugUnit_Application
@ AJA_DebugUnit_Application
Definition: debugshare.h:58
AJADebug::GetMessageTime
static AJAStatus GetMessageTime(const uint64_t sequenceNumber, uint64_t &outTime)
Definition: debug.cpp:622
atomic.h
Declares the AJAAtomic class.
AJADebug::TotalBytes
static uint32_t TotalBytes(void)
Definition: debug.cpp:304
AJADebug::GetMessageLineNumber
static AJAStatus GetMessageLineNumber(const uint64_t sequenceNumber, int32_t &outLineNumber)
Definition: debug.cpp:694
AJA_DebugUnit_TimecodeGeneric
@ AJA_DebugUnit_TimecodeGeneric
Definition: debugshare.h:53
AJA_STATUS_DISABLED
@ AJA_STATUS_DISABLED
Definition: types.h:390
AJA_DebugUnit_CC708Window
@ AJA_DebugUnit_CC708Window
Definition: debugshare.h:74
AJADebug::GetProcessId
static AJAStatus GetProcessId(const uint64_t sequenceNumber, uint64_t &outPid)
Definition: debug.cpp:768
AJADebug::IsOpen
static bool IsOpen(void)
Definition: debug.cpp:313
AJA_DebugUnit_Size
@ AJA_DebugUnit_Size
Definition: debugshare.h:151
true
#define true
Definition: ntv2devicefeatures.h:26
AJA_DebugUnit_CC708ServiceBlockQueue
@ AJA_DebugUnit_CC708ServiceBlockQueue
Definition: debugshare.h:73
AJADebugStat::Minimum
uint32_t Minimum(size_t inNum=11) const
Definition: debug.cpp:1309
AJADebug::GetMessagesIgnored
static AJAStatus GetMessagesIgnored(uint64_t &outCount)
Definition: debug.cpp:820
AJA_DebugStat_WriteRegister
@ AJA_DebugStat_WriteRegister
Definition: debugshare.h:225
AJADebug::HasStats
static bool HasStats(void)
Definition: debug.cpp:1052
_AJADebugMessage::tid
uint64_t tid
Definition: debugshare.h:211
AJA_DebugUnit_RPCClient
@ AJA_DebugUnit_RPCClient
Definition: debugshare.h:103
AJADebugStat::Reset
void Reset(void)
Definition: debugshare.h:275
AJA_DebugUnit_RPCServer
@ AJA_DebugUnit_RPCServer
Definition: debugshare.h:102
AJA_DebugStat_DMATransfer
@ AJA_DebugStat_DMATransfer
Definition: debugshare.h:241
operator<<
std::ostream & operator<<(std::ostream &oss, const AJADebugStat &inStat)
Definition: debug.cpp:1497
AJA_DEBUG_DESTINATION_NONE
#define AJA_DEBUG_DESTINATION_NONE
Definition: debugshare.h:165
_AJADebugMessage::destinationMask
uint32_t destinationMask
Definition: debugshare.h:207
AJA_STATUS_OPEN
@ AJA_STATUS_OPEN
Definition: types.h:388
AJADebug::Disable
static AJAStatus Disable(int32_t index, uint32_t destination=AJA_DEBUG_DESTINATION_NONE)
Definition: debug.cpp:233
AJA_STATUS_SURPRISE_REMOVAL
@ AJA_STATUS_SURPRISE_REMOVAL
Definition: types.h:401
StatKeyNameMap
map< int, string > StatKeyNameMap
Definition: debug.cpp:1417
AJA_DebugUnit_Avid
@ AJA_DebugUnit_Avid
Definition: debugshare.h:83
AJA_DebugUnit_DriverGeneric
@ AJA_DebugUnit_DriverGeneric
Definition: debugshare.h:48
aja::to_string
std::string to_string(bool val)
Definition: common.cpp:180
AJADebug::GetMessageText
static AJAStatus GetMessageText(const uint64_t sequenceNumber, std::string &outMessage)
Definition: debug.cpp:730
gStatKeyToStrReady
static bool gStatKeyToStrReady(false)
AJA_DebugUnit_CC708Service
@ AJA_DebugUnit_CC708Service
Definition: debugshare.h:72
AJA_STATUS_BADBUFFERCOUNT
@ AJA_STATUS_BADBUFFERCOUNT
Definition: types.h:410
AJA_DebugUnit_Watcher
@ AJA_DebugUnit_Watcher
Definition: debugshare.h:61
AJA_DebugUnit_CCLine21Encode
@ AJA_DebugUnit_CCLine21Encode
Definition: debugshare.h:64
AJA_DebugStat_WaitForInterruptIn1
@ AJA_DebugStat_WaitForInterruptIn1
Definition: debugshare.h:226
AJA_DebugUnit_VideoGeneric
@ AJA_DebugUnit_VideoGeneric
Definition: debugshare.h:51
thread.h
Declares the AJAThread class.
AJA_DebugStat_WaitForInterruptIn3
@ AJA_DebugStat_WaitForInterruptIn3
Definition: debugshare.h:228
AJADebug::MessageRingCapacity
static uint32_t MessageRingCapacity(void)
Definition: debug.cpp:506
AJADebug::GetMessageWallClockTime
static AJAStatus GetMessageWallClockTime(const uint64_t sequenceNumber, int64_t &outTime)
Definition: debug.cpp:639
AJA_DEBUG_MESSAGE_RING_SIZE
#define AJA_DEBUG_MESSAGE_RING_SIZE
Definition: debugshare.h:186
AJATime::GetSystemCounter
static int64_t GetSystemCounter(void)
Returns the current value of the host system's high-resolution time counter.
Definition: systemtime.cpp:112
AJA_DebugStat_WaitForInterruptIn4
@ AJA_DebugStat_WaitForInterruptIn4
Definition: debugshare.h:229
_AJADebugShare::version
uint32_t version
Definition: debugshare.h:329
memory.h
Declares the AJAMemory class.
STAT_BIT_SET
#define STAT_BIT_SET
Definition: debug.cpp:40
AJA_STATUS_NOTINITIALIZED
@ AJA_STATUS_NOTINITIALIZED
Definition: types.h:413
_AJADebugShare::statCapacity
uint32_t statCapacity
Definition: debugshare.h:341
AJADebugStat
Definition: debugshare.h:262
AJA_DebugUnit_QuickTime
@ AJA_DebugUnit_QuickTime
Definition: debugshare.h:59
AJA_DEBUG_STATE_FILE_VERSION
#define AJA_DEBUG_STATE_FILE_VERSION
Definition: debugshare.h:190
AJADebug::StatGetSequenceNum
static AJAStatus StatGetSequenceNum(uint32_t &outSeqNum)
Definition: debug.cpp:1286
AJATime::GetSystemFrequency
static int64_t GetSystemFrequency(void)
Returns the frequency of the host system's high-resolution time counter.
Definition: systemtime.cpp:149
AJA_DebugUnit_App_DiskRead
@ AJA_DebugUnit_App_DiskRead
Definition: debugshare.h:87
debug.h
Declares the AJADebug class.
AJA_DebugUnit_DemoCapture
@ AJA_DebugUnit_DemoCapture
Definition: debugshare.h:98
AJA_DebugUnit_AutoCirculate
@ AJA_DebugUnit_AutoCirculate
Definition: debugshare.h:85
AJA_DEBUG_MESSAGE_MAX_SIZE
#define AJA_DEBUG_MESSAGE_MAX_SIZE
Definition: debugshare.h:185
AJAAtomic::Decrement
static int32_t Decrement(int32_t volatile *pTarget)
Definition: atomic.cpp:95
AJA_DebugStat_WaitForInterruptIn5
@ AJA_DebugStat_WaitForInterruptIn5
Definition: debugshare.h:230
_AJADebugMessage::groupIndex
int32_t groupIndex
Definition: debugshare.h:206
_AJADebugShare::messageFileNameCapacity
uint32_t messageFileNameCapacity
Definition: debugshare.h:335
AJA_DebugStat_ACXferRPCEncode
@ AJA_DebugStat_ACXferRPCEncode
Definition: debugshare.h:248
AJADebug::StatFree
static AJAStatus StatFree(const uint32_t inKey)
Definition: debug.cpp:1078
AJA_DEBUG_FILE_NAME_MAX_SIZE
#define AJA_DEBUG_FILE_NAME_MAX_SIZE
Definition: debugshare.h:187