common_mem_prof/
lib.rs

1// Copyright 2023 Greptime 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
15pub mod error;
16
17#[cfg(not(windows))]
18mod jemalloc;
19#[cfg(not(windows))]
20pub use jemalloc::{
21    activate_heap_profile, deactivate_heap_profile, dump_flamegraph, dump_pprof, dump_profile,
22    is_heap_profile_active,
23};
24
25#[cfg(windows)]
26pub async fn dump_profile() -> error::Result<Vec<u8>> {
27    error::ProfilingNotSupportedSnafu.fail()
28}
29
30#[cfg(windows)]
31pub async fn dump_pprof() -> error::Result<Vec<u8>> {
32    error::ProfilingNotSupportedSnafu.fail()
33}
34
35#[cfg(windows)]
36pub async fn dump_flamegraph() -> error::Result<Vec<u8>> {
37    error::ProfilingNotSupportedSnafu.fail()
38}
39
40#[cfg(windows)]
41pub fn activate_heap_profile() -> error::Result<()> {
42    error::ProfilingNotSupportedSnafu.fail()
43}
44
45#[cfg(windows)]
46pub fn deactivate_heap_profile() -> error::Result<()> {
47    error::ProfilingNotSupportedSnafu.fail()
48}
49
50#[cfg(windows)]
51pub fn is_heap_profile_active() -> error::Result<bool> {
52    error::ProfilingNotSupportedSnafu.fail()
53}