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