Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CPU profiling sections of code #3971

Merged
merged 24 commits into from May 6, 2019
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b156a05
Support profiling sections of code
breeswish Dec 24, 2018
9ddf5e9
Support Callgrind
breeswish Dec 24, 2018
2091eda
Make rustfmt and clippy happy
breeswish Dec 24, 2018
35eb12c
Fix doc test
breeswish Dec 25, 2018
213229e
start profiling without env variables
breeswish Jan 2, 2019
1827120
Merge remote-tracking branch 'origin/master' into __profiler
breeswish Jan 2, 2019
05f25ac
Fix lock
breeswish Jan 2, 2019
6003a20
Merge remote-tracking branch 'origin/master' into __profiler
breeswish Apr 10, 2019
27d4973
Merge remote-tracking branch 'origin/master' into __profiler
breeswish Apr 12, 2019
e59f569
Use tikv_alloc
breeswish Apr 12, 2019
0c7e44b
Merge branch 'master' into __profiler
breeswish Apr 15, 2019
8105a60
Merge branch 'master' into __profiler
breeswish Apr 15, 2019
d7e919f
Merge branch 'master' into __profiler
breeswish Apr 18, 2019
9c677dd
Merge branch 'master' into __profiler
breeswish Apr 18, 2019
f4c67e5
Merge branch 'master' into __profiler
breeswish Apr 25, 2019
3998965
Merge branch 'master' into __profiler
breeswish Apr 25, 2019
5bc7552
Address comments about the returning value
breeswish Apr 28, 2019
ed94239
Merge remote-tracking branch 'origin/master' into __profiler
breeswish Apr 28, 2019
e22fe77
Upgrade dependency
breeswish Apr 28, 2019
3fe352c
Merge branch 'master' into __profiler
breeswish Apr 29, 2019
dd57f1d
Merge branch 'master' into __profiler
breeswish Apr 29, 2019
0df8cc7
Merge branch 'master' into __profiler
ice1000 Apr 29, 2019
8db777f
Merge branch 'master' into __profiler
breeswish May 6, 2019
048008c
Merge branch 'master' into __profiler
brson May 6, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

Support profiling sections of code

Signed-off-by: Breezewish <breezewish@pingcap.com>
  • Loading branch information...
breeswish committed Dec 24, 2018
commit b156a0524bf1c6cfc4cf1bc9051928817a776bcd

Some generated files are not rendered by default. Learn more.

@@ -10,6 +10,7 @@ portable = ["rocksdb/portable"]
sse = ["rocksdb/sse"]
mem-profiling = ["jemallocator/profiling"]
no-fail = ["fail/no_fail"]
cpu-profiling = []

[lib]
name = "tikv"
@@ -101,15 +102,16 @@ num = "0.2"
num-traits = "0.2"
hex = "0.3"
rust-crypto = "^0.2"
panic_hook = { path = "components/panic_hook" }
base64 = "0.10"
safemem = "0.3"
cop_datatype = { path = "components/cop_datatype" }
smallvec = { version = "0.6", features = ["union"] }
flate2 = { version = "1.0", features = ["zlib"], default-features = false }
more-asserts = "0.1"
hyper = "0.12"
tokio-threadpool = "0.1"
cop_datatype = { path = "components/cop_datatype" }
panic_hook = { path = "components/panic_hook" }
cpu_profiler = { path = "components/cpu_profiler" }

[dependencies.murmur3]
git = "https://github.com/pingcap/murmur3.git"
@@ -0,0 +1,7 @@
[package]
name = "cpu_profiler"
version = "0.0.1"
publish = false

[target.'cfg(target_os = "linux")'.dependencies]
cpuprofiler = "0.0.3"
@@ -0,0 +1,27 @@
// Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(target_os = "linux")]
extern crate cpuprofiler;

#[cfg(all(target_os = "linux", feature = "cpu-profiling"))]
mod profiler_linux;

#[cfg(all(target_os = "linux", feature = "cpu-profiling"))]
pub use profiler_linux::*;

#[cfg(not(all(target_os = "linux", feature = "cpu-profiling")))]
mod profiler_dummy;

#[cfg(not(all(target_os = "linux", feature = "cpu-profiling")))]
pub use profiler_dummy::*;
@@ -0,0 +1,27 @@
// Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.

#[inline]
pub fn start(_fname: impl Into<Vec<u8>>) {
// Do nothing
}

#[inline]
pub fn stop() {
// Do nothing
}

#[inline]
pub fn is_enabled() -> bool {
false
}
@@ -0,0 +1,29 @@
// Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.

use cpuprofiler::PROFILER;

#[inline]
pub fn start(fname: impl Into<Vec<u8>>) {
PROFILER.lock().unwrap().start(fname).unwrap();
}

#[inline]
pub fn stop() {
PROFILER.lock().unwrap().stop().unwrap();
}

#[inline]
pub fn is_enabled() -> bool {
true
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.