Skip to content

Commit b6c756c

Browse files
add doc for new features
1 parent 2882479 commit b6c756c

File tree

1 file changed

+73
-7
lines changed

1 file changed

+73
-7
lines changed

docs/modules/tutorial/pages/configurationfiles/benchmark/scalability.adoc

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
Lists all the files where performance variables can be found.
55

66
directory [*str*]::
7-
Common directory where files containing performance variables can be found.
7+
Common directory where files containing performance variables can be found. This field is optional **only if all stages extract from `stdout`**.
8+
If at least one stage extracts from a file, `directory` must be provided.
9+
810

911
clean_directory [*bool*] (Optional)::
1012
If true, it will delete the contents of inside `directory`.
@@ -13,16 +15,16 @@ clean_directory [*bool*] (Optional)::
1315
stages [*List[Stage]*]::
1416
Describes the files containing performance variables, and how to extract them.
1517

16-
-name [*str*]:::
18+
-name [*str* (Optional)]:::
1719
Name to describe the stage. It is used as prefix to add to the performance variables found in the file.
18-
If no prefix is needed, the name can be "".
20+
If no prefix is needed, the name can be ommited.
1921

20-
-filepath [*str*]:::
21-
Relative filepath of the file containing performance variables, relative to the `directory` field.
22+
-filepath [*str*|"stdout"]:::
23+
Can be either "stdout" or relative filepath of the file containing performance variables, relative to the `directory` field.
2224

2325
-format [*str*]:::
2426
Format of the stage file.
25-
Supported values are "csv" and "json".
27+
Supported values are "regex", "csv" and "json".
2628

2729
-units [*Dict[str,str]*] (Optional):::
2830
Custom units for certain performance variables.
@@ -35,6 +37,16 @@ stages [*List[Stage]*]::
3537
Only valid if format is "json".
3638
Defines where, in the JSON hierrarchy, performance variables will be found. Supports the use of one or multiple wildcards (`*`).
3739

40+
-pattern [*str*]:::
41+
Required if format is `regex`. The regular expression applied to each line. Accepts named and arbitrary capture groups.
42+
43+
-variable_value_group[*str|int*]:::
44+
Required if format is `regex`
45+
The capture group containing the performance value to extract. Can be named or an integer.
46+
47+
-variable_name_group[*str|int* (Optional)]:::
48+
The capture group containing the performance variable name to extract. If ommited, variables are named automatically as `match_0`, `match_1`, ...
49+
3850
custom_variables [*List[Dict[str,str]]*] (Optional)::
3951
Contains a list of objects describing custom performance variables to create, based on extracted ones (from stages). An aggregation will be performed using provided columns and valid operations.
4052
For more information, see the xref:tutorial:advancedConfiguration.adoc[advanced Configuration]
@@ -63,6 +75,24 @@ Recursive creation of custom_variables is supported!
6375
Deeply nested and complex JSON scalability files are supported, using multiple wildcard syntax!
6476
====
6577

78+
79+
== Extracting from standard output
80+
81+
Stages may extract performance variables directly from the application standard output by setting:
82+
83+
[source,json]
84+
----
85+
"filepath": "stdout"
86+
----
87+
88+
This works with any supported file format (e.g. logging a csv on the stdout).
89+
90+
The top-level directory field is not required if ALL stages extract from stdout.
91+
92+
[TIP]
93+
Mixing `stdout` and file-based stages is allowed but requires `directory` to be set
94+
95+
6696
== Examples
6797

6898
Let's assume our application exports the following files:
@@ -199,4 +229,40 @@ If a full path is passed, the variable name corresponds to the key of the leaf
199229
[TIP]
200230
====
201231
`variables_path` can be a list.
202-
====
232+
====
233+
234+
235+
=== Extracting performance variables using `regex`
236+
237+
Assume the application prints the following lines to standard output:
238+
239+
[source,text]
240+
----
241+
assembly: 0.012
242+
solve: 1.42
243+
postprocess: 0.08
244+
----
245+
246+
A minimal `regex` stage extracting these values from `stdout` is shown below.
247+
248+
[source,json]
249+
----
250+
"scalability": {
251+
"stages": [
252+
{
253+
"name": "timers",
254+
"filepath": "stdout",
255+
"format": "regex",
256+
"pattern": "^(?P<name>[^:\\n]+):\\s*(?P<value>[-+]?[\\d.]+(?:[eE][-+]?\\d+)?)$",
257+
"variable_name_group": "name",
258+
"variable_value_group": "value"
259+
}
260+
]
261+
}
262+
----
263+
264+
This configuration extracts the following performance variables:
265+
266+
- timers_assembly : 0.012
267+
- timers_solve : 1.42
268+
- timers_postprocess : 0.08

0 commit comments

Comments
 (0)