NAME

topper::datasink - Data output handler.


SYNOPSIS

  use topper::datasink;
  $config->load('path/to/somefile.conf');
  # <snip>
  # ... init topper::database object and topper::otuput object.
  # </snip>
  my $ds = topper::datasink->new($config,$database_object,$output_object);
  $ds->start_new_process();
  $ds->process_name("foo");
  $ds->process_pid(1234);
  # ... etc
  $ds->run_output();


DESCRIPTION

This package provides a wrapper for writing the actual output of process info to a destination, which can be a database, or perhaps an xml file, etc,... (Currently only mysql database sink is implemented).

Methods

new(topper::config configuration_object, topper::database database_object, topper::output output_object)

Constructor. Initialises class member variables.

Input: topper::config Pass the configuration object. Input: topper::database Pass the database object. Input: topper::output Pass the output object. Output: blessed object.

start_new_process()

Begins processing output for a new process.

Input: Nothing. Output: Nothing.

reset_entry_time()

Resets timestamps to current date and time for process entries that follow.

Input: Nothing. Output: Nothing.

process_pid

Sets pid for current process.

Input: (int) pid Output: Nothing.

process_user

Sets user for current process.

Input: (string) user Output: Nothing.

process_cpu

Sets cpu usage for current process.

Input: (number) cpu Output: Nothing.

process_mem

Sets memory consumption for current process.

Input: (number) memory Output: Nothing.

process_name

Sets command name for current process.

Input: (string) name Output: Nothing.

run_output

Begins processing output for current process into configured sink.

Input: Nothing Output: Nothing.