Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Task Class Reference

A structure to store data about a task. More...

#include <Task.hh>

Inheritance diagram for Task:

PTC_Task List of all members.

Public Methods

 Task ()
 The constructor.

void mark_quanta_start (const timestamp_t system_cycle_time, const timestamp_t system_instruction_time, const timestamp_t system_reference_time)
 Record the system time at the start of a quanta.

void mark_time (const timestamp_t system_cycle_time, const timestamp_t system_instruction_time, const timestamp_t system_reference_time)
 Record time that has passed for this task.


Public Attributes

task_ID_t task_ID
 A unique task number.

Processprocess
 A pointer to the process to which this task belongs.

Task * parent_task
 The parent from which this task was forked.

timestamp_t virtual_cycle_time
 The cycle time that has passed for this task alone.

timestamp_t virtual_instruction_time
 The instruction time that has passed for this task alone.

timestamp_t virtual_reference_time
 The reference time that has passed for this task alone.

timestamp_t last_system_cycle_time
 The most recently observed system cycle time.

timestamp_t last_system_instruction_time
 The most recently observed system instruction time.

timestamp_t last_system_reference_time
 The most recently observed system reference time.


Detailed Description

A structure to store data about a task.

See also:
Process
Tasks are the Linux equivalent of a kernel-level thread. One or more tasks, using a virtual address space, constitute a process. Note that we make data members public for simplicity of access, violating good OO programming guidelines.

Definition at line 46 of file Task.hh.


Constructor & Destructor Documentation

Task::Task  
 

The constructor.

Initialize a task by zeroing its fields.

Definition at line 19 of file Task.cc.

References last_system_cycle_time, last_system_instruction_time, last_system_reference_time, parent_task, process, task_ID, virtual_cycle_time, virtual_instruction_time, and virtual_reference_time.

00019             {
00020 
00021   // Initialize all of the data members to zero/null.
00022   task_ID = 0;
00023   process = NULL;
00024   parent_task = NULL;
00025   virtual_cycle_time = 0;
00026   virtual_instruction_time = 0;
00027   virtual_reference_time = 0;
00028   last_system_cycle_time = 0;
00029   last_system_instruction_time = 0;
00030   last_system_reference_time = 0;
00031 
00032 } // Task::Task


Member Function Documentation

void Task::mark_quanta_start const timestamp_t    system_cycle_time,
const timestamp_t    system_instruction_time,
const timestamp_t    system_reference_time
 

Record the system time at the start of a quanta.

Update the system time so that subsequent events can be recorded as an advance in virtual time for this task.

Definition at line 39 of file Task.cc.

References last_system_cycle_time, last_system_instruction_time, and last_system_reference_time.

00041                                                 {
00042 
00043   // Bump up the observed system time, but not the virtual time, as
00044   // this is the beginning of a quanta, and time passed since the last
00045   // observed system time was due to some other task.
00046   last_system_cycle_time = system_cycle_time;
00047   last_system_instruction_time = system_instruction_time;
00048   last_system_reference_time = system_reference_time;
00049 
00050 } // Task::mark_quanta_start

void Task::mark_time const timestamp_t    system_cycle_time,
const timestamp_t    system_instruction_time,
const timestamp_t    system_reference_time
 

Record time that has passed for this task.

Update the system time and the virtual time according to the time that has passed since the last observed system time.

Definition at line 57 of file Task.cc.

References last_system_cycle_time, last_system_instruction_time, last_system_reference_time, timestamp_t, virtual_cycle_time, virtual_instruction_time, and virtual_reference_time.

Referenced by Consumer::merge().

00059                                               {
00060 
00061   // How much time has passed since the last call to this method?
00062   timestamp_t cycle_time_passed =
00063     system_cycle_time - last_system_cycle_time;
00064   timestamp_t instruction_time_passed =
00065     system_instruction_time - last_system_instruction_time;
00066   timestamp_t reference_time_passed =
00067     system_reference_time - last_system_reference_time;
00068 
00069   // Update the virtual time that has passed for this task, as this
00070   // method is called only when this task is scheduled.
00071   virtual_cycle_time += cycle_time_passed;
00072   virtual_instruction_time += instruction_time_passed;
00073   virtual_reference_time += reference_time_passed;
00074 
00075   // Bump up the observed system time.
00076   last_system_cycle_time = system_cycle_time;
00077   last_system_instruction_time = system_instruction_time;
00078   last_system_reference_time = system_reference_time;
00079 
00080 } // Task::mark_time


Member Data Documentation

timestamp_t Task::last_system_cycle_time
 

The most recently observed system cycle time.

Definition at line 100 of file Task.hh.

Referenced by mark_quanta_start(), mark_time(), and Task().

timestamp_t Task::last_system_instruction_time
 

The most recently observed system instruction time.

Definition at line 103 of file Task.hh.

Referenced by mark_quanta_start(), mark_time(), and Task().

timestamp_t Task::last_system_reference_time
 

The most recently observed system reference time.

Definition at line 106 of file Task.hh.

Referenced by mark_quanta_start(), mark_time(), and Task().

Task* Task::parent_task
 

The parent from which this task was forked.

Definition at line 86 of file Task.hh.

Referenced by Consumer::Consumer(), Consumer::handle_context_assignment(), Consumer::handle_fork(), and Task().

Process* Task::process
 

A pointer to the process to which this task belongs.

Definition at line 83 of file Task.hh.

Referenced by Per_Task_Consumer::act_on_reference_record(), Consumer::Consumer(), Consumer::handle_anonymous_mmap_range(), Consumer::handle_context_assignment(), Consumer::handle_cow_unmap(), Consumer::handle_exec(), Consumer::handle_file_mmap_range(), Consumer::handle_fork(), Consumer::handle_munmap_range(), Consumer::handle_shmat(), Per_Task_Consumer::Per_Task_Consumer(), Per_Task_Consumer::PTC_handle_context_assignment(), Task(), and Consumer::unlink_task_and_process().

task_ID_t Task::task_ID
 

A unique task number.

Definition at line 80 of file Task.hh.

Referenced by Per_Task_Consumer::act_on_kernel_record(), Consumer::Consumer(), Consumer::handle_fork(), Per_Task_Consumer::Per_Task_Consumer(), Per_Task_Consumer::PTC_handle_context_assignment(), and Task().

timestamp_t Task::virtual_cycle_time
 

The cycle time that has passed for this task alone.

Definition at line 89 of file Task.hh.

Referenced by Per_Task_Consumer::act_on_kernel_record(), Per_Task_Consumer::act_on_reference_record(), mark_time(), and Task().

timestamp_t Task::virtual_instruction_time
 

The instruction time that has passed for this task alone.

Definition at line 93 of file Task.hh.

Referenced by Per_Task_Consumer::act_on_kernel_record(), Per_Task_Consumer::act_on_reference_record(), mark_time(), and Task().

timestamp_t Task::virtual_reference_time
 

The reference time that has passed for this task alone.

Definition at line 97 of file Task.hh.

Referenced by Per_Task_Consumer::act_on_kernel_record(), Per_Task_Consumer::act_on_reference_record(), mark_time(), and Task().


The documentation for this class was generated from the following files:
Generated on Fri Jan 31 10:33:40 2003 for Laplace-merge by doxygen1.3-rc2