reference Flags

--time

Accepted by
opengrep scan, opengrep ci
Also spelled
--no-time
Default
false
See also
--json, --jobs, --timeout

Adds timing data to the run. With the text output, standard error shows a summary: the total time, the time spent loading the rules and running the engine, and the slowest files and rules. With --json, the document has a time object with the time of each pair of rule and target, the parse times, the peak memory use and the number of bytes scanned.

The numbers depend on the machine and on the run. The format of the timing data is internal and may change.

Examples

The timing object in the JSON output

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(1)
Command and result
$ opengrep scan --config rule.yaml --json --time app.py 2>/dev/null | jq .
{
  "version": "X.Y.Z",
  "results": [
    {
      "check_id": "find-eval",
      "path": "app.py",
      "start": {
        "line": 1,
        "col": 1,
        "offset": 0
      },
      "end": {
        "line": 1,
        "col": 8,
        "offset": 7
      },
      "extra": {
        "metavars": {},
        "message": "found eval",
        "metadata": {},
        "severity": "WARNING",
        "fingerprint": "cc2ee9ac3b87e874db7ede72562f586db0607e44a6ebc8879fc1772bd2699a2f302d90e0cf6bde9dce450cb0891646fb0b3d70263351681e1d2e48ca0d26d960_0",
        "lines": "eval(1)",
        "is_ignored": false,
        "validation_state": "NO_VALIDATOR",
        "engine_kind": "Opengrep"
      }
    }
  ],
  "errors": [],
  "paths": {
    "scanned": [
      "app.py"
    ]
  },
  "time": {
    "rules": [
      "find-eval"
    ],
    "rules_parse_time": 0.0001850128173828125,
    "profiling_times": {
      "config_time": 0.0001919269561767578,
      "core_time": 0.004815816879272461,
      "ignores_time": 0.00004696846008300781,
      "total_time": 0.005388021469116211
    },
    "targets": [
      {
        "path": "app.py",
        "num_bytes": 8,
        "match_times": [
          [
            "find-eval",
            0.000030994415283203125
          ]
        ],
        "parse_time": 0.00013685226440429688,
        "run_time": 0.00043892860412597656
      }
    ],
    "total_bytes": 8,
    "max_memory_bytes": 88461696
  },
  "interfile_languages_used": [],
  "skipped_rules": []
}