# PetscLogView
Prints a summary of the logging. 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscLogView(PetscViewer viewer)
```
Collective over MPI_Comm


## Input Parameter

- ***viewer -*** an ASCII viewer



## Options Database Keys

- ***-log_view [:filename] -*** Prints summary of log information
- ***-log_view :filename.py:ascii_info_detail -*** Saves logging information from each process as a Python file
- ***-log_view :filename.xml:ascii_xml -*** Saves a summary of the logging information in a nested format (see below for how to view it)
- ***-log_view :filename.txt:ascii_flamegraph -*** Saves logging information in a format suitable for visualising as a Flame Graph (see below for how to view it)
- ***-log_view_memory -*** Also display memory usage in each event
- ***-log_view_gpu_time -*** Also display time in each event for GPU kernels (Note this may slow the computation)
- ***-log_all -*** Saves a file Log.rank for each MPI rank with details of each step of the computation
- ***-log_trace [filename] -*** Displays a trace of what each process is doing





## Notes
It is possible to control the logging programmatically but we recommend using the options database approach whenever possible
By default the summary is printed to stdout.

Before calling this routine you must have called either PetscLogDefaultBegin() or PetscLogNestedBegin()

If PETSc is configured with --with-logging=0 then this functionality is not available

To view the nested XML format filename.xml first copy  ${PETSC_DIR}/share/petsc/xml/performance_xml2html.xsl to the current
directory then open filename.xml with your browser. Specific notes for certain browsers
```none
Firefox and Internet explorer - simply open the file
```
```none
Google Chrome - you must start up Chrome with the option --allow-file-access-from-files
```
```none
Safari - see https://ccm.net/faq/36342-safari-how-to-enable-local-file-access
```
or one can use the package http://xmlsoft.org/XSLT/xsltproc2.html to translate the xml file to html and then open it with
your browser.
Alternatively, use the script ${PETSC_DIR}/lib/petsc/bin/petsc-performance-view to automatically open a new browser
window and render the XML log file contents.

The nested XML format was kindly donated by Koos Huijssen and Christiaan M. Klaij  MARITIME  RESEARCH  INSTITUTE  NETHERLANDS

The Flame Graph output can be visualised using either the original Flame Graph script (https://github.com/brendangregg/FlameGraph)
or using speedscope (https://www.speedscope.app).
Old XML profiles may be converted into this format using the script ${PETSC_DIR}/lib/petsc/bin/xml2flamegraph.py.


## See Also
 [](ch_profiling), `PetscLogDefaultBegin()`, `PetscLogDump()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/logging/plog.c.html#PetscLogView">src/sys/logging/plog.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex1f.F90.html">src/snes/tutorials/ex1f.F90.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/logging/plog.c)


[Index of all Profiling routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
