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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
83 changes: 65 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Expand Up @@ -15,6 +15,7 @@ jemalloc = ["tikv_alloc/jemalloc"]
portable = ["engine/portable"]
sse = ["engine/sse"]
mem-profiling = ["tikv_alloc/mem-profiling"]
profiling = ["profiler/profiling"]
no-fail = ["fail/no_fail"]

[lib]
Expand Down Expand Up @@ -115,6 +116,7 @@ hyper = { version = "0.12", default-features = false, features = ["runtime"] }
tokio-threadpool = "0.1.13"
vlog = "0.1.4"
twoway = "0.2.0"
profiler = { path = "components/profiler" }
cop_datatype = { path = "components/cop_datatype" }
panic_hook = { path = "components/panic_hook" }
tipb = { git = "https://github.com/pingcap/tipb.git" }
Expand Down
21 changes: 21 additions & 0 deletions components/profiler/Cargo.toml
@@ -0,0 +1,21 @@
[package]
name = "profiler"
version = "0.0.1"
edition = "2018"
publish = false
breezewish marked this conversation as resolved.
Show resolved Hide resolved

[features]
profiling = ["lazy_static", "cpuprofiler", "callgrind", "valgrind_request"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it compile on Windows without the feature enabled?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work though I don't have a Windows machine. I changed it to [target.'cfg(linux)'.dependencies] and it can compile on my MacOS.


[dependencies]
tikv_alloc = { path = "../tikv_alloc" }

[target.'cfg(unix)'.dependencies]
lazy_static = { version = "1.3.0", optional = true }
cpuprofiler = { version = "0.0.3", optional = true }
callgrind = { version = "1.1.0", optional = true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is valgrind a useful use case? I think most of the time only cpuprofiling is used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valgrind is very useful for micro benchmark, which can report precise amount of function calls, as well as precise (emulated) cache hit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also hoping that this crate can be extended into a general purpose profiling module that can be published for the community, and ultimately fulfill the various requirements of the Go profiling tools. More profiler options in that case seems good.

valgrind_request = { version = "1.1.0", optional = true }

[[example]]
name = "prime"
required-features = ["profiling"]