BSD-Process

 view release on metacpan or  search on metacpan

Process.pm  view on Meta::CPAN

# BSD::Process.pm
#
# Copyright (c) 2006-2013 David Landgren
# All rights reserved

package BSD::Process;

use strict;
use warnings;

use Exporter;
use XSLoader;
use base qw(Class::Accessor);

use vars qw($VERSION @ISA @EXPORT_OK);
$VERSION = '0.07';
@ISA = qw(Exporter Class::Accessor);

@EXPORT_OK = (qw(process_info process_list P));

BEGIN {
    my %alias = (
        process_pid              => 'pid',
        parent_pid               => 'ppid',
        process_group_id         => 'pgid',
        tty_process_group_id     => 'tpgid',
        process_session_id       => 'sid',
        job_control_counter      => 'jobc',
        resident_set_size        => 'rssize',
        rssize_before_swap       => 'swrss',
        text_size                => 'tsize',
        exit_status              => 'xstat',
        accounting_flags         => 'acflag',
        percent_cpu              => 'pctcpu',
        estimated_cpu            => 'estcpu',
        sleep_time               => 'slptime',
        time_last_swap           => 'swtime',
        elapsed_time             => 'runtime',
        process_flags            => 'flag',
        nice_priority            => 'nice',
        process_lock_count       => 'lock',
        run_queue_index          => 'rqindex',
        current_cpu              => 'oncpu',
        last_cpu                 => 'lastcpu',
        wchan_message            => 'wmesg',
        setlogin_name            => 'login',
        command_name             => 'comm',
        process_args             => 'args',
        terminal_session_id      => 'tsid',
        effective_user_id        => 'uid',
        real_user_id             => 'ruid',
        saved_effective_user_id  => 'svuid',
        real_group_id            => 'rgid',
        saved_effective_group_id => 'svgid',
        number_of_groups         => 'ngroups',
        group_list               => 'groups',
        virtual_size             => 'size',
        data_size                => 'dsize',
        stack_size               => 'ssize',
        start_time               => 'start',
        children_time            => 'childtime',
        posix_advisory_lock      => 'advlock',
        has_controlling_terminal => 'controlt',
        is_kernel_thread         => 'kthread',
        no_loadavg_calc          => 'noload',
        parent_waiting           => 'ppwait',
        started_profiling        => 'profil',
        stopped_profiling        => 'stopprof',
        id_privs_set             => 'sugid',
        system_process           => 'system',
        single_exit_not_wait     => 'single_exit',
        traced_by_debugger       => 'traced',
        waited_on_by_other       => 'waited',
        working_on_exiting       => 'wexit',
        process_called_exec      => 'exec',
        kernel_session_flag      => 'kiflag',
        is_locked                => 'locked',
        controlling_tty_active   => 'isctty',
        is_session_leader        => 'issleader',
        process_status           => 'stat',
        is_being_forked          => 'stat_1',
        is_runnable              => 'stat_2',
        is_sleeping_on_addr      => 'stat_3',
        is_stopped               => 'stat_4',
        is_a_zombie              => 'stat_5',
        is_waiting_on_intr       => 'stat_6',
        is_blocked               => 'stat_7',
        old_command_name         => 'ocomm',
        name_of_lock             => 'lockname',
        priority_scheduling_class => 'pri_class',
        priority_level            => 'pri_level',
        priority_native           => 'pri_native',
        priority_user             => 'pri_user',
        user_time                 => 'utime',

Process.pm  view on Meta::CPAN


=item real_user_id, ruid

The user id of the user that launched the process. B<F5+>

=item saved_effective_user_id, svuid

The saved effective user id of the process. (purpose?) B<F5+>

=item real_group_id, rgid

The primary group id of the user that launched the process.

The symbolic name of the gid will be returned if the constructor
had the C<resolve> attribute set. B<F5+>

=item saved_effective_group_id, svgid

The saved effective group id of the process. (purpose?) B<F5+>

=item number_of_groups, ngroups

The number of groups to which the process belongs. B<F5+>

=item group_list, groups

A reference to an array of group ids (gids) to which the process belongs. B<F5+>

=item virtual_size, size

The size (in bytes) of virtual memory occupied by the process. B<F5+>

=item resident_set_size, rssize

The size (in kilobytes) of physical memory occupied by the process.

=item rssize_before_swap, swrss

The resident set size of the process before the last swap.

=item text_size, tsize

Text size (in pages) of the process.

=item data_size, dsize

Data size (in pages) of the process. B<F5+>

=item stack_size, ssize

Stack size (in pages) of the process. B<F5+>

=item exit_status, xstat

Exit status of the process (usually zero).

=item accounting_flags, acflag

Process accounting flags (TODO: decode them).

=item percent_cpu, pctcpu

Percentage of CPU time used by the process (for the duration of
swtime, see below).

=item estimated_cpu, estcpu

Time averaged value of ki_cpticks. (as per the comment in user.h,
purpose?)

=item sleep_time, slptime

Number of seconds since the process was last blocked.

=item time_last_swap, swtime

Number of seconds since the process was last swapped in or out.

=item elapsed_time, runtime

Real time used by the process, in microseconds.

=item start_time, start

Epoch time of the creation of the process. B<F5+>

=item children_time, childtime

Amount of real time used by the children processes (if any) of the
process. B<F5+>

=item process_flags, flag

A bitmap of process flags (decoded in the following methods as 0
or 1).

=item posix_advisory_lock, advlock

Flag indicating whether the process holds a POSIX advisory lock. B<F5+>

=item has_controlling_terminal, controlt

Flag indicating whether the process has a controlling terminal (if
true, the terminal session id is stored in the C<tsid> attribute). B<F5+>

=item is_kernel_thread, kthread

Flag indicating whether the process is a kernel thread. B<F5+>

=item no_loadavg_calc, noload

Flag indicating whether the process contributes to the load average
calculations of the system. B<F5+>

=item parent_waiting, ppwait

Flag indicating whether the parent is waiting for the process to
exit. B<F5+>

=item started_profiling, profil



( run in 0.710 second using v1.01-cache-2.11-cpan-39bf76dae61 )