:orphan:
# 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 Parameter
- ***ksp -*** the iterative context
## Output Parameter
- ***its -*** total number of iterations
## Note
Use `KSPGetIterationNumber()` to get the count for the most recent solve only
If this is called within a `KSPSolve()` (such as in a `KSPMonitor` routine) then it does not include iterations within that current solve
## See Also
[](ch_ksp), `KSP`, `KSPBuildResidual()`, `KSPGetResidualNorm()`, `KSPGetIterationNumber()`
## Level
intermediate
## Location
src/ksp/ksp/interface/iterativ.c
## Examples
src/ksp/ksp/tutorials/ex10.c
src/ksp/ksp/tutorials/ex100.c
src/ksp/ksp/tutorials/ex76.c
src/snes/tutorials/ex5.c
src/snes/tutorials/ex55.c
---
[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](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)