Skip to content

Commit 3449b0e

Browse files
committed
Updated docs
1 parent 43ad1ec commit 3449b0e

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
### Enhancements
44

5+
* It is now possible to configure runtime profiling of the `zappend`
6+
processing using the new configuration setting `profiling`. [#39]
7+
58
* Allow for passing custom slice sources via the configuration.
69
The new configuration setting `slice_source` is the name of a class
710
derived from `zappend.api.SliceSource` or a function that creates an instance

docs/config.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,41 @@ Type _boolean_.
187187
If 'true', log only what would have been done, but don't apply any changes.
188188
Defaults to `false`.
189189

190+
### `profiling`
191+
192+
Profiling configuration. Allows for runtime profiling of the processing.
193+
Must be one of the following:
194+
* Type _boolean_.
195+
If set, profiling is enabled and output is logged using level INFO. Otherwise, profiling is disabled.
196+
* Type _string_.
197+
Profile path. Enables profiling and writes a profiling report to given path.
198+
* Type _object_.
199+
200+
* `enabled`:
201+
Type _boolean_.
202+
Enable or disable profiling.
203+
* `path`:
204+
Type _string_.
205+
Local file path for profiling output.
206+
* `log_level`:
207+
Log level. Use 'NOTSET' to disable logging.
208+
Defaults to `"INFO"`.
209+
Must be one of `"CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "NOTSET"`.
210+
* `keys`:
211+
Type _array_.
212+
Sort output according to the supplied column names. Refer to [Stats.sort_stats(*keys)](https://docs.python.org/3/library/profile.html#pstats.Stats.sort_stats).
213+
214+
Must be one of `"calls", "cumulative", "cumtime", "file", "filename", "module", "ncalls", "pcalls", "line", "name", "nfl", "stdname", "time", "tottime"`.
215+
* `restrictions`:
216+
Type _array_.
217+
Used to limit the list down to the significant entries in the profiling report. Refer to [Stats.print_stats(*restrictions)](https://docs.python.org/3/library/profile.html#pstats.Stats.print_stats).
218+
219+
Must be one of the following:
220+
* Type _integer_.
221+
* Type _number_.
222+
* Type _string_.
223+
224+
190225
### `logging`
191226

192227
Type _object_.

docs/guide.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,49 @@ zappend(["slice-1.nc", "slice-2.nc", "slice-3.nc"],
618618
slice_source=MySliceSource)
619619
```
620620

621+
## Profiling
622+
623+
Runtime profiling is very important for understanding program runtime behavior
624+
and performance. The configuration setting `profiling` can be used to
625+
analyse and improve the runtime performance of `zappend` itself as well as
626+
the runtime performance of the computation of in-memory slices passed to the
627+
`zappend()` function.
628+
629+
To log the output of the profiling with level `INFO` (see next section
630+
[Logging](#logging)), you can use the value `true`:
631+
632+
```json
633+
{
634+
"profiling": true
635+
}
636+
```
637+
638+
If you like to see the output in a file too, then set `profiling` to the
639+
desired local file path:
640+
641+
```json
642+
{
643+
"profiling": "perf.out"
644+
}
645+
```
646+
647+
You can also set `profiling` to an object that allows for fine-grained
648+
control of the runtime logging:
649+
650+
```json
651+
{
652+
"profiling": {
653+
"log_level": "WARNING",
654+
"path": "perf.out",
655+
"keys": ["tottime", "time", "ncalls"]
656+
}
657+
}
658+
```
659+
660+
Please refer to section [`profiling`](config.md#profiling) in
661+
the [Configuration Reference](config.md) for more details.
662+
663+
621664
## Logging
622665

623666
The `zappend` logging output is configured using the `logging` setting.

0 commit comments

Comments
 (0)