Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Statistics.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#include "Stroika/Foundation/StroikaPreComp.h"
5
7
8#include "Statistics.h"
9
10using namespace Stroika::Foundation;
11using namespace Stroika::Foundation::Cache;
12using namespace Stroika::Foundation::Cache::Statistics;
14
15/*
16 ********************************************************************************
17 ********************************** Stats_Basic *********************************
18 ********************************************************************************
19 */
21{
22 size_t hits = fCachedCollected_Hits.load (); // use local variable so if changes behind the scenes we report consistenly
23 size_t misses = fCachedCollected_Misses.load ();
24 size_t total = hits + misses;
25 if (total == 0) {
26 total = 1; // avoid divide by zero
27 }
28 return Format ("{ hits: {}, misses: {}, hit%: {} }"_f, hits, misses, float (hits) / float (total));
29}
30
31/*
32 ********************************************************************************
33 ************************************ Stats_Null ********************************
34 ********************************************************************************
35 */
37{
38 return {};
39}
LRUCache implements a simple least-recently-used caching strategy, with optional hashing (of keys) to...
Definition LRUCache.h:94
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
nonvirtual Characters::String ToString() const
nonvirtual Characters::String ToString() const