MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / queryData

Method queryData

src/lock/lock.cpp:845–940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

843
844
845LOCK_DATA_T LockManager::queryData(const USHORT series, const USHORT aggregate)
846{
847/**************************************
848 *
849 * q u e r y D a t a
850 *
851 **************************************
852 *
853 * Functional description
854 * Query lock series data with respect to a rooted
855 * lock hierarchy calculating aggregates as we go.
856 *
857 **************************************/
858 if (series >= LCK_MAX_SERIES)
859 {
860 CHECK(false);
861 return 0;
862 }
863
864 LOCK_TRACE(("LM::queryData (%ld)\n", owner_offset));
865
866 LockTableGuard guard(this, FB_FUNCTION, DUMMY_OWNER);
867
868 ++(m_sharedMemory->getHeader()->lhb_query_data);
869
870 const srq& data_header = m_sharedMemory->getHeader()->lhb_data[series];
871 LOCK_DATA_T data = 0, count = 0;
872
873 // Simply walk the lock series data queue forward for the minimum
874 // and backward for the maximum -- it's maintained in sorted order.
875
876 switch (aggregate)
877 {
878 case LCK_CNT:
879 case LCK_AVG:
880 case LCK_SUM:
881 for (const srq* lock_srq = (SRQ) SRQ_ABS_PTR(data_header.srq_forward);
882 lock_srq != &data_header; lock_srq = (SRQ) SRQ_ABS_PTR(lock_srq->srq_forward))
883 {
884 const lbl* const lock = (lbl*) ((UCHAR*) lock_srq - offsetof(lbl, lbl_lhb_data));
885 CHECK(lock->lbl_series == series);
886
887 switch (aggregate)
888 {
889 case LCK_CNT:
890 ++count;
891 break;
892
893 case LCK_AVG:
894 ++count;
895
896 case LCK_SUM:
897 data += lock->lbl_data;
898 break;
899 }
900 }
901
902 if (aggregate == LCK_CNT)

Callers 1

LCK_query_dataFunction · 0.80

Calls 1

getHeaderMethod · 0.45

Tested by

no test coverage detected