Skip to content

Commit 8bff162

Browse files
committed
Extend a bit the Readme documentation.
1 parent 532a1af commit 8bff162

File tree

1 file changed

+93
-11
lines changed

1 file changed

+93
-11
lines changed

Readme.md

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
# Readme
22

3-
> **_NOTE:_** This project is not totally functional yet.
4-
53
This project is a sort of rust improved reimplementation of
6-
[ExtraeWin](https://github.com/Ergus/ExtraeWin).
7-
8-
The main goal is to use native rust code to generate instrumentation
9-
for highly concurrency code.
4+
[ExtraeWin](https://github.com/Ergus/ExtraeWin). The main goal is to
5+
use native rust code to generate instrumentation for highly
6+
concurrency code. In a format compatible with the
7+
[Paraver][https://tools.bsc.es/paraver] flexible performance analysis
8+
tool.
9+
10+
For more complex or distributed systems (specially outside the Rust
11+
world) and HPC I strongly recommend using
12+
[Extrae](https://tools.bsc.es/extrae) instead of this.
13+
14+
The current implementation is intended to work almost lock-free and
15+
with minimal overhead for traces generation. Currently the code needs
16+
to be instrumented with some of the methods described in the
17+
[Usage](#usage) section.
18+
19+
There are pending features in the [TODO](#todo) section but the
20+
project is functional AS IS. I am open to new features and features
21+
requests with a compromise to include them if they fit in the project
22+
objective, are intended to be really useful and don't imply any extra
23+
performance impact/overhead or excessive complexity.
1024

1125
## Usage
1226

13-
At the moment the core includes 3 instrumentation methods:
27+
At the moment the core includes 3 instrumentation methods. Using a
28+
single methods to instrument is generally preferred (the best
29+
instrumentation is the one that does not bother your code
30+
logic). However, the three methods can be freely mixed if the user
31+
wants to.
1432

1533
### With declarative macros:
1634

@@ -19,18 +37,33 @@ At the moment the core includes 3 instrumentation methods:
1937
// This instruments all the function scope
2038
fn myfunction()
2139
{
22-
instrument_function!();
40+
instrument_function!();
2341
// Some code
42+
43+
// This is a scope to be instrumented automatically
44+
{
45+
instrument_scope!("MyScope");
46+
// Some code
47+
}
2448
}
2549

26-
// Specifying the function name
50+
// Specifying the function name to show in the trace
2751
fn myfunction2()
2852
{
2953
instrument_function!("MyFunction2_manual");
3054
// Some code
55+
56+
// This is a scope to be instrumented with a custom value
57+
{
58+
instrument_scope!("MyScope2");
59+
// Some code
60+
instrument_update!(10); // Can use any possitive value > 1
61+
}
62+
3163
}
3264

33-
// Also specify the event number
65+
// Also specify the event number, this is usefull when we want to enforce
66+
// events numbers to create fancy paraver events filters.
3467
fn myfunction3()
3568
{
3669
instrument_function!("MyFunction3_manual_value_20", 20);
@@ -40,20 +73,29 @@ fn myfunction3()
4073

4174
### With procedural macros:
4275

76+
With procedural macros we can instrument complete functions more
77+
easily. However to instrument scopes we still need to use declarative
78+
macros.
79+
80+
4381
```rust
4482

83+
// This instruments all the function scope
4584
#[extrae_profile]
4685
fn myfunction()
4786
{
4887
// Some code
4988
}
5089

90+
// Specifying the function name to show in the trace
5191
#[extrae_profile(name="MyFunction2_manual")]
5292
fn myfunction2()
5393
{
5494
// Some code
5595
}
5696

97+
// Also specify the event number, this is usefull when we want to enforce
98+
// events numbers to create fancy paraver events filters.
5799
#[extrae_profile(name="MyFunction3_manual_value_20",value=20)]
58100
fn myfunction3()
59101
{
@@ -63,6 +105,12 @@ fn myfunction3()
63105

64106
### Tokio integration.
65107

108+
Tokio already has imtegration with the
109+
[tracing](https://crates.io/crates/tracing) crate. While the method it
110+
uses is a bit different in philosophy, Extrae-rs provides out of the
111+
box integration and some extra features.
112+
113+
66114
```rust
67115

68116
#[tracing::instrument]
@@ -163,7 +211,7 @@ exist.
163211
The profiler prints the name of the directory at the end of the
164212
execution, which is useful when the directory name is auto-generated.
165213

166-
### Trace direcotry format
214+
### Trace directory format
167215

168216
The trace directory directory contains multiple trace files:
169217
`Trace_[tid].bin`. There is one of such files for every thread created
@@ -182,7 +230,41 @@ be used to read the binary trace file as plain text.
182230

183231
For example:
184232

233+
### Paraver basics description
234+
235+
Paraver events have 2 basic parameters: `id` and `value`.
236+
237+
For functions and scoped events the `id` is internally assigned by the
238+
profiler during the execution. A `value=1` indicate the event is
239+
starting in that point and `value=0` indicates the end of the
240+
event.
241+
242+
The user don't need to emit those values manually and the provided
243+
macros automate these values.
244+
245+
Any `value > 1` can be emitted with the `instrument_update` macro in
246+
order to have more detailed information of the function's parts.
247+
248+
When enables, other events like performance counters are emitted
249+
together with the instrumented ones.
250+
251+
You can find a set of [Paraver
252+
tutorials](https://tools.bsc.es/paraver-tutorials) from their
253+
creators. And a useful video introduction to
254+
[Paraver](https://www.youtube.com/watch?v=R8_EhVpOzb0)
255+
256+
185257
```shell
186258
./target/debug/visualizer TRACEDIR_1735338966/Trace_1.bin
187259
```
188260

261+
## TODO
262+
263+
1. OTF2 format generator. To use with vampir and other profilers.
264+
2. CTF format. There are some nice tools to work with this format, but
265+
nothing that paraver can't do with a right config. Any way I
266+
consider this because it is intended to be very simple to
267+
implement.
268+
3. Add compatibility with the
269+
[profiling](https://crates.io/crates/profiling) crate. This works
270+
almost exactly like this project, but with different macro names.

0 commit comments

Comments
 (0)