LinuxCommandLibrary

pup

Extract data from HTML at the command line

TLDR

Transform a raw HTML file into a cleaned, indented, and colored format

$ cat [index.html] | pup --color
copy

Filter HTML by element tag name
$ cat [index.html] | pup '[tag]'
copy

Filter HTML by ID
$ cat [index.html] | pup '[div#id]'
copy

Filter HTML by attribute value
$ cat [index.html] | pup '[input[type="text"]]'
copy

Print all text from the filtered HTML elements and their children
$ cat [index.html] | pup '[div] text{}'
copy

Print HTML as JSON
$ cat [index.html] | pup '[div] json{}'
copy

SYNOPSIS

pup [options] -- program [program arguments]

PARAMETERS

--frequency=cycles
    Number of cycles to collect before reporting events

--perf=event
    Select a specific perf event (e.g., cache-misses).

--pid=pid
    Profile an already running process by process ID.

--json
    Output results in JSON format.

--version
    Show the program version.

--help
    Display a help message.

DESCRIPTION

Pup is a command-line tool designed for profiling the execution of other programs. It allows users to analyze the performance characteristics of a target application by tracing system calls, signals, and other events. Pup uses perf_events interface. It provides a flexible and configurable interface for collecting and analyzing performance data.

Pup focuses on providing detailed insights into the execution of processes, including the time spent in different system calls, the number of signals received, and other relevant metrics. This information can be used to identify bottlenecks and optimize the performance of target applications.

CAVEATS

Pup relies on the perf_events subsystem of the Linux kernel. Ensure that perf_events is properly configured and accessible for accurate profiling.

EXAMPLES

pup --frequency=1000 -- ls -l: Profiles the 'ls -l' command, sampling every 1000 cycles.

pup --pid=1234 -- json: Profiles the process with PID 1234 and outputs the results in JSON format.

OUTPUT INTERPRETATION

The output of pup provides a detailed breakdown of the execution time spent in various system calls and events. Use this information to identify areas where the target application is spending the most time and focus your optimization efforts accordingly. The JSON output can be parsed for automated analysis.

HISTORY

Pup is a relatively modern tool, designed to provide a unified interface for process profiling using modern kernel features. It aims to provide a user-friendly way to leverage the power of perf_events for performance analysis.

SEE ALSO

perf(1), strace(1), ltrace(1)

Copied to clipboard