Flow-IPC 3.0.0
Flow-IPC project: Full implementation reference.
pool_arena_stats.cpp
Go to the documentation of this file.
1/* Flow-IPC: Shared Memory
2 * Copyright 2023 Akamai Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the
5 * "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 * CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License. */
17
18/// @file
19
21#include "ipc/util/util_fwd.hpp"
22#include <flow/util/string_view.hpp>
23#include <flow/util/stat/stat_set.hpp>
24
26{
27
28// Implementations.
29
30std::ostream& operator<<(std::ostream& os, const Arena_info_dump& val)
31{
33 using flow::util::stat::print;
34
35 if (val.m_arena_sz_or_0 == 0)
36 {
37 // Per contract: arena_sz 0 <=> source Pool_arena failed to attach its pool (invalid); no stats exist.
38 return os << "[no SHM-pool attached/no stats avail]";
39 }
40 // else: valid Pool_arena.
41
42 String_view ln; // Top-level-item separator.
43 if (val.m_fmt.m_multiline)
44 {
45 os << "- ";
46 ln = "\n- ";
47 }
48 else
49 {
50 ln = " | ";
51 }
52
53 return os << "arena: free_sz=[" << val.m_arena_stat_free_sz << '/' << val.m_arena_sz_or_0 << "] "
54 "[" << print(val.m_arena_stats) << ']' << ln
55 << "local: [" << print(val.m_local_stats) << ']'; // Intentional: no newline at the end.
56} // operator<<(ostream&, Arena_info_dump)
57
58} // namespace ipc::shm::classic::stat
Stats-related sub-namespace, for ADL segregation and general organization.
Definition: classic_fwd.hpp:53
std::ostream & operator<<(std::ostream &os, const Arena_info_dump &val)
Prints string representation of the given Arena_info_dump to the given ostream.
flow::util::String_view String_view
Short-hand for Flow's String_view.
Definition: util_fwd.hpp:112
Printable (with knobs in contained util::stat::Info_dump_format) bundling of stats/info pertaining to...
Arena_stats m_arena_stats
The source Pool_arena's (shared, in-SHM) arena stats from: Pool_arena::arena_stats(); meaningless/ign...
size_t m_arena_sz_or_0
The source Pool_arena's Pool_arena::arena_size(); 0 if and only if that Pool_arena was invalid (its c...
Local_stats m_local_stats
The source Pool_arena object's stats from: Pool_arena::local_stats(); meaningless/ignorable if m_aren...
size_t m_arena_stat_free_sz
The source Pool_arena's Pool_arena::arena_stat_free_size(); meaningless/ignorable if m_arena_sz_or_0 ...
util::stat::Info_dump_format m_fmt
Print-format knobs in effect at ostream << *this time.
bool m_multiline
If true: Use newlines where appropriate for readability (except at the very end of the output); if fa...
Definition: util.hpp:81