# KSPGetTotalIterations
Gets the total number of iterations this `KSP` object has performed since was created, counted over all linear solves 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPGetTotalIterations(KSP ksp, PetscInt *its)
```
Not Collective


## Input Parameters

- ***ksp -*** the iterative context



## Output Parameters

- ***its -*** total number of iterations





## Note
Use `KSPGetIterationNumber()` to get the count for the most recent solve only
If this is called within a linear solve (such as in a `KSPMonitor` routine) then it does not include iterations within that current solve


## See Also
 [](chapter_ksp), `KSP`, `KSPBuildResidual()`, `KSPGetResidualNorm()`, `KSPGetIterationNumber()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/interface/iterativ.c.html#KSPGetTotalIterations">src/ksp/ksp/interface/iterativ.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex10.c.html">src/ksp/ksp/tutorials/ex10.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex100.c.html">src/ksp/ksp/tutorials/ex100.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex5.c.html">src/snes/tutorials/ex5.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex55.c.html">src/snes/tutorials/ex55.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/interface/iterativ.c)


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