function::qs_run - Linux


Overview

qs_run is a command-line utility used to perform a quick scan of a running process or a core dump file. It’s commonly employed to identify potential memory allocation issues within a Linux system.

Syntax

qs_run [-h] [-r] [-C] [-S] [-e PATH] [-c] [-f] [-a] [-s] [--qsp | --pdf | --text] [--] [pid|corefile]

Options/Flags

  • -h, –help: Display usage help and exit.
  • -r, –raw: Output raw data without any formatting.
  • -C, –compact: Display data in a compact format.
  • -S, –sort: Sort results by memory usage.
  • -e PATH, –excludes=PATH: Exclude a specific path from the scan. Can be specified multiple times.
  • -c, –count: Display only the count of objects allocated.
  • -f, –filter: Filter results based on a given pattern.
  • -a, –all: Display all available information.
  • -s, –summary: Display a summary of the scan results.
  • –qsp: Generate a QSP output file.
  • –pdf: Generate a PDF report.
  • –text: Generate a text report.
  • : End option parsing and pass remaining arguments as positional.

Examples

Simple usage:

qs_run 1234

Exclude a specific path:

qs_run -e /tmp/excluded_path 1234

Generate a QSP output file:

qs_run --qsp 1234

Common Issues

  • If no arguments are provided, qs_run will default to scanning the current process.
  • Invalid process IDs or paths will result in an error message.
  • Using the --qsp or --pdf options requires the qsp and qsreports packages to be installed.

Integration

qs_run can be integrated with other tools for advanced memory analysis. For example, you can pipe the output of qs_run into grep to filter results:

qs_run -r 1234 | grep "\[my_object\]"

Related Commands

  • pmap: Display detailed memory information about a process.
  • valgrind: A memory analysis tool that can detect memory leaks and other issues.
  • gprof2: A profiling tool that can show how a program allocates and uses memory.