userver
C++ Async Framework
Toggle main menu visibility
Documentation
API Groups
Namespaces
Reference
Class List
Class Index
File List
Macros
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
jemalloc.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/server/handlers/jemalloc.hpp
4
/// @brief @copybrief server::handlers::Jemalloc
5
6
#
include
<
userver
/
server
/
handlers
/
http_handler_base
.
hpp
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
server::handlers {
11
12
// clang-format off
13
14
/// @ingroup userver_components userver_http_handlers
15
///
16
/// @brief Handler that controls the jemalloc allocator.
17
///
18
/// The component has no service configuration except the
19
/// @ref userver_http_handlers "common handler options".
20
///
21
/// ## Static configuration example:
22
///
23
/// @snippet components/common_server_component_list_test.cpp Sample handler jemalloc component config
24
///
25
/// ## Schema
26
/// Set an URL path argument `command` to one of the following values:
27
/// * `stat` - to get jemalloc stats
28
/// * `enable` - to start memory profiling
29
/// * `disable` - to stop memory profiling
30
/// * `dump` - to get jemalloc profiling dump
31
/// * `bg_threads_set_max` - to set maximum number of background threads
32
/// * `bg_threads_enable` - to start background threads
33
/// * `bg_threads_disable` - to *synchronously* stop background threads
34
35
// clang-format on
36
37
class
Jemalloc
final
:
public
HttpHandlerBase
{
38
public
:
39
enum
class
Command {
40
kStat,
41
kEnable,
42
kDisable,
43
kDump,
44
kBgThreadsSetMax,
45
kBgThreadsEnable,
46
kBgThreadsDisable,
47
};
48
static
std::optional<Command> GetCommandFromString(std::string_view str);
49
static
std::string ListCommands();
50
51
Jemalloc(
const
components
::ComponentConfig&,
const
components
::ComponentContext&);
52
53
/// @ingroup userver_component_names
54
/// @brief The default name of server::handlers::Jemalloc
55
static
constexpr
std::string_view
kName
=
"handler-jemalloc"
;
56
57
std::string
HandleRequestThrow
(
const
http
::HttpRequest&,
request
::RequestContext&)
const
override
;
58
59
static
yaml_config
::Schema GetStaticConfigSchema();
60
};
37
class
Jemalloc
final
:
public
HttpHandlerBase
{
…
};
61
62
}
// namespace server::handlers
63
64
template
<>
65
inline
constexpr
bool
components
::kHasValidate<server::handlers::Jemalloc> =
true
;
66
67
USERVER_NAMESPACE_END
userver
server
handlers
jemalloc.hpp
Generated on Wed Apr 30 2025 15:54:12 for userver by
Doxygen
1.13.2