### 13.6 Metrics

GPS provides an interface with the GNAT software metrics generation tool `gnatmetric`.

The metrics can be computed for the entire project, one source file belonging to the project, or (when applicable) a specific entity in the source file, e.g. a subprogram.

The metrics generator can be invoked either from the `Tools->Metrics` menu or from the contextual menu.

#### 13.6.1 The Metrics Menu

The `Metrics` submenu is available from the `Tools` global menu and contains:

`Compute metrics for root project`
  Generate metrics for all files from the root project.
`Compute metrics for current file`
  Generate metrics for the current source file.

#### 13.6.2 The Contextual Menu

When relevant (depending on the context), right-clicking with your mouse will show metrics-related contextual menu entries.

From a source file contextual menu, you have an option called `Metrics for file` that will generate the metrics for the current file.

From a project contextual menu (see The Project View), you have an option `Metrics for project` that will generate the metrics for all files in the project.

After having computed metrics, a new window in the left-side area is displayed showing the computed metrics as a hierarchical tree view. The metrics are arranged by files, and then by scopes inside the files in a nested fashion. Double-clicking on any of the files or scopes displayed will open the appropriate source location in the editor. Any errors encountered during metrics computation will be displayed in the Locations Window.