Stroika Library 3.0d23
 
Loading...
Searching...
No Matches
OperationalStatistics.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4
5namespace Stroika::Samples::HTMLUI {
6
7 /*
8 ********************************************************************************
9 ***************** OperationalStatisticsMgr::ProcessAPICmd **********************
10 ********************************************************************************
11 */
12 inline OperationalStatisticsMgr::ProcessAPICmd::ProcessAPICmd ()
13 : fStart_{Time::GetTickCount ()}
14 {
15 }
16
17 /*
18 ********************************************************************************
19 ****************** OperationalStatisticsMgr::ProcessDBCmd **********************
20 ********************************************************************************
21 */
22 inline OperationalStatisticsMgr::ProcessDBCmd::ProcessDBCmd (DBCommandType cmdType)
23 : fStart_{Time::GetTickCount ()}
24 {
25 switch (cmdType) {
26 case DBCommandType::eRead:
27 fKind_ = Rec_::Kind::eDBRead;
28 break;
29 case DBCommandType::eWrite:
30 fKind_ = Rec_::Kind::eDBWrite;
31 break;
32 default:
34 }
35 }
36
37 /*
38 ********************************************************************************
39 ************************** OperationalStatisticsMgr ****************************
40 ********************************************************************************
41 */
42 inline void OperationalStatisticsMgr::Add_ (const Rec_& r)
43 {
44 lock_guard lk{fMutex_};
45 ++fNextHistory_;
46 if (fNextHistory_ == std::size (fRollingHistory_)) {
47 fNextHistory_ = 0;
48 }
49 Assert (fNextHistory_ < std::size (fRollingHistory_));
50 fRollingHistory_[fNextHistory_] = r;
51 }
52
53}
#define RequireNotReached()
Definition Assertions.h:386
TimePointSeconds GetTickCount() noexcept
get the current (monotonically increasing) time - from RealtimeClock
Definition Realtime.inl:16