profiling 4
parent
1569c8d567
commit
5274268104
@ -1,4 +1,4 @@
|
||||
This chapter makes use of Google's [cpuprofiler](http://goog-perftools.sourceforge.net/doc/cpu_profiler.html),
|
||||
which needs to be installed separately. It will not be installed through the normal cargo build process.
|
||||
This chapter makes use of Cargo Profiler and valgrind.
|
||||
They will not be installed through the normal cargo build process and need separate installation.
|
||||
|
||||
[GPerftools](https://github.com/gperftools/gperftools) is also available on Github.
|
||||
[Cargo Profiler](https://github.com/kernelmachine/cargo-profiler) installation instructions are available on Github.
|
||||
|
@ -0,0 +1,23 @@
|
||||
fn a(n: u64) -> u64 {
|
||||
if n>0 {
|
||||
b(n);
|
||||
b(n);
|
||||
}
|
||||
n * n
|
||||
}
|
||||
|
||||
fn b(n: u64) -> u64 {
|
||||
c(n);
|
||||
c(n);
|
||||
n + 2 / 3
|
||||
}
|
||||
|
||||
fn c(n: u64) -> u64 {
|
||||
a(n-1);
|
||||
a(n-1);
|
||||
vec![1, 2, 3].into_iter().map(|x| x+2).sum()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
a(6);
|
||||
}
|
Loading…
Reference in New Issue