1
1
# Readme
2
2
3
- > ** _ NOTE:_ ** This project is not totally functional yet.
4
-
5
3
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.
10
24
11
25
## Usage
12
26
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.
14
32
15
33
### With declarative macros:
16
34
@@ -19,18 +37,33 @@ At the moment the core includes 3 instrumentation methods:
19
37
// This instruments all the function scope
20
38
fn myfunction ()
21
39
{
22
- instrument_function! ();
40
+ instrument_function! ();
23
41
// Some code
42
+
43
+ // This is a scope to be instrumented automatically
44
+ {
45
+ instrument_scope! (" MyScope" );
46
+ // Some code
47
+ }
24
48
}
25
49
26
- // Specifying the function name
50
+ // Specifying the function name to show in the trace
27
51
fn myfunction2 ()
28
52
{
29
53
instrument_function! (" MyFunction2_manual" );
30
54
// 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
+
31
63
}
32
64
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.
34
67
fn myfunction3 ()
35
68
{
36
69
instrument_function! (" MyFunction3_manual_value_20" , 20 );
@@ -40,20 +73,29 @@ fn myfunction3()
40
73
41
74
### With procedural macros:
42
75
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
+
43
81
``` rust
44
82
83
+ // This instruments all the function scope
45
84
#[extrae_profile]
46
85
fn myfunction ()
47
86
{
48
87
// Some code
49
88
}
50
89
90
+ // Specifying the function name to show in the trace
51
91
#[extrae_profile(name= " MyFunction2_manual" )]
52
92
fn myfunction2 ()
53
93
{
54
94
// Some code
55
95
}
56
96
97
+ // Also specify the event number, this is usefull when we want to enforce
98
+ // events numbers to create fancy paraver events filters.
57
99
#[extrae_profile(name= " MyFunction3_manual_value_20" ,value= 20)]
58
100
fn myfunction3 ()
59
101
{
@@ -63,6 +105,12 @@ fn myfunction3()
63
105
64
106
### Tokio integration.
65
107
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
+
66
114
``` rust
67
115
68
116
#[tracing:: instrument]
@@ -163,7 +211,7 @@ exist.
163
211
The profiler prints the name of the directory at the end of the
164
212
execution, which is useful when the directory name is auto-generated.
165
213
166
- ### Trace direcotry format
214
+ ### Trace directory format
167
215
168
216
The trace directory directory contains multiple trace files:
169
217
` 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.
182
230
183
231
For example:
184
232
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
+
185
257
``` shell
186
258
./target/debug/visualizer TRACEDIR_1735338966/Trace_1.bin
187
259
```
188
260
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