Skip to main content

rustfs_config/constants/
profiler.rs

1// Copyright 2024 RustFS Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/// Profiler related environment variable names and default values
16pub const ENV_ENABLE_PROFILING: &str = "RUSTFS_ENABLE_PROFILING";
17
18// Legacy local CPU pprof controls. Local pprof dumps are currently unsupported;
19// Pyroscope export is configured through observability settings.
20pub const ENV_CPU_MODE: &str = "RUSTFS_PROF_CPU_MODE"; // off|continuous|periodic
21/// Frequency of CPU profiling samples
22pub const ENV_CPU_FREQ: &str = "RUSTFS_PROF_CPU_FREQ";
23/// Interval between CPU profiling sessions (for periodic mode)
24pub const ENV_CPU_INTERVAL_SECS: &str = "RUSTFS_PROF_CPU_INTERVAL_SECS";
25/// Duration of each CPU profiling session (for periodic mode)
26pub const ENV_CPU_DURATION_SECS: &str = "RUSTFS_PROF_CPU_DURATION_SECS";
27
28/// Periodic memory pprof dumps (currently unsupported with mimalloc)
29pub const ENV_MEM_PERIODIC: &str = "RUSTFS_PROF_MEM_PERIODIC";
30/// Interval between memory profiling snapshots (for periodic mode)
31pub const ENV_MEM_INTERVAL_SECS: &str = "RUSTFS_PROF_MEM_INTERVAL_SECS";
32
33/// Output directory
34pub const ENV_OUTPUT_DIR: &str = "RUSTFS_PROF_OUTPUT_DIR";
35
36/// Defaults for profiler settings
37pub const DEFAULT_ENABLE_PROFILING: bool = false;
38/// Legacy local CPU pprof mode
39pub const DEFAULT_CPU_MODE: &str = "off";
40/// Frequency of CPU profiling samples
41pub const DEFAULT_CPU_FREQ: usize = 100;
42/// Interval between CPU profiling sessions (for periodic mode)
43pub const DEFAULT_CPU_INTERVAL_SECS: u64 = 300;
44/// Duration of each CPU profiling session (for periodic mode)
45pub const DEFAULT_CPU_DURATION_SECS: u64 = 60;
46/// Periodic memory pprof dumps (currently unsupported with mimalloc)
47pub const DEFAULT_MEM_PERIODIC: bool = false;
48/// Interval between memory profiling snapshots (for periodic mode)
49pub const DEFAULT_MEM_INTERVAL_SECS: u64 = 300;
50/// Output directory
51pub const DEFAULT_OUTPUT_DIR: &str = ".";