# Timing performance through python?

**URL:** https://discourse.paraview.org/t/timing-performance-through-python/9320
**Category:** ParaView Support
**Created:** [March 31, 2022, 3:09pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320 "2022-03-31T15:09:34Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [March 31, 2022, 3:09pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/1 "2022-03-31T15:09:34Z")

</div>

I have an application that uses paraview through python via the simple module, and I am trying to determine where the performance bottlenecks are. Is there a way to access the filter timings logs in python or some other way?

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave_demarle/32/27_2.png) [@Dave\_DeMarle](https://discourse.paraview.org/u/Dave_DeMarle)
#### Post date: [March 31, 2022, 5:31pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/2 "2022-03-31T17:31:33Z")

</div>

import paraview.benchmarks and logbase.py inside will give you access to the internal timer logs which you can serialize and print and such.

Be warned that the the logparse.py functions, which used to interpret the contents into a nice summary of the per frame and per filter stats, seem to have degraded over the years and are not currently usable.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [March 31, 2022, 5:50pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/3 "2022-03-31T17:50:33Z")

</div>

Another option, perhaps more verbose, is as follows:

```auto
> mpirun -np 2 ./bin/pvbatch -l /tmp/logs.txt,TRACE -- /tmp/sample.py

```

this will generate /tmp/logs.txt.0, /tmp/logs.txt.1, … which give more info about various inner workings. You can qualify the log to only print filter execution info, for example, using something like the following:

```auto
> env PARAVIEW_LOG_EXECUTION_VERBOSITY=INFO \
   mpirun -np 2 ./bin/pvbatch -l /tmp/logs.txt -- /tmp/sample.py

```

Available variables are documented [here](https://kitware.github.io/paraview-docs/nightly/cxx/EnvironmentVariables.html).

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [March 31, 2022, 7:02pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/4 "2022-03-31T19:02:02Z")

</div>

Thank you Dave and thank you Utkarsh! This sounds like exactly what I was looking for and I will investigate.

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [March 31, 2022, 8:28pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/5 "2022-03-31T20:28:00Z")

</div>

I have been playing with the benchmark.logbase.print\_logs, but I don’t understand how to use it. If print the logs, then do work, I see the same log (identical data) as the first print (i.e., there isn’t any additional data). Any clues?

The trace is way more verbose, but because its verbose, its hard to read.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [April 1, 2022, 1:42pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/6 "2022-04-01T13:42:58Z")

</div>

> [@mclarsen](#):
>
> The trace is way more verbose, but because its verbose, its hard to read.

Did you try limiting to a specific category using environment variables? I tend to prefer these since they do give a good sense of the bottlenecks.

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [April 1, 2022, 4:02pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/7 "2022-04-01T16:02:03Z")

</div>

I was able to add the env var export to our launching. Its nice to see it in the console since you can match what you see with what you did. Thanks!

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [June 13, 2025, 8:28pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/8 "2025-06-13T20:28:42Z")

</div>

I ran into this again just recently and noted that the solution was only logging the execution time of pipeline objects. It was missing the rendering times. I found that is controlled by a separate environment variable: `PARAVIEW_LOG_RENDERING_VERBOSITY`. I believe this one was created after the initial question was answered. I noticed that some documentation [like this](https://www.paraview.org/paraview-docs/latest/cxx/EnvironmentVariables.html) is missing this particular environment variable.

You should be able to get a list of environment variables from the [documentation of vtkPVLogger](https://www.paraview.org/paraview-docs/latest/cxx/vtkPVLogger_8h.html). The names of the macros should be synchronized with the names of the environment variables.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [June 18, 2025, 6:31pm UTC](https://discourse.paraview.org/t/timing-performance-through-python/9320/9 "2025-06-18T18:31:08Z")

</div>

A merge request documenting that environment variable is here: [https://gitlab.kitware.com/paraview/paraview/-/merge\_requests/7364](https://gitlab.kitware.com/paraview/paraview/-/merge_requests/7364)
