KSPGetTotalIterations — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# 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

KSP: Linear System Solvers, `KSP`, `KSPBuildResidual()`, `KSPGetResidualNorm()`, `KSPGetIterationNumber()`

## Level

intermediate

## Location

src/ksp/ksp/interface/iterativ.c

## Examples

src/ksp/ksp/tutorials/ex87.c
src/snes/tutorials/ex5.c
src/ksp/ksp/tutorials/ex100.c
src/ksp/ksp/tutorials/ex10.c
src/snes/tutorials/ex55.c
src/ksp/ksp/tutorials/ex76.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages