userver: userver/server/handlers/jemalloc.hpp Source File
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
8USERVER_NAMESPACE_BEGIN
9
10namespace 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
32// clang-format on
33
34class Jemalloc final : public HttpHandlerBase {
35public:
36 Jemalloc(const components::ComponentConfig&, const components::ComponentContext&);
37
38 /// @ingroup userver_component_names
39 /// @brief The default name of server::handlers::Jemalloc
40 static constexpr std::string_view kName = "handler-jemalloc";
41
42 std::string HandleRequestThrow(const http::HttpRequest&, request::RequestContext&) const override;
43
44 static yaml_config::Schema GetStaticConfigSchema();
45};
46
47} // namespace server::handlers
48
49template <>
50inline constexpr bool components::kHasValidate<server::handlers::Jemalloc> = true;
51
52USERVER_NAMESPACE_END