1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
/* -*- Mode:C++ -*- */
/*
* process_view.hh
* Copyright (C) 1999 by John Heidemann
* $Id: process_view.hh,v 1.24 1999/09/14 05:28:10 johnh Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef lavaps_process_view_h
#define lavaps_process_view_h
#include <unistd.h> // pid_t
#include <stl.h>
#include <functional>
#include <set>
#include "blob.hh"
#include "change_tracking.hh"
class process_model;
class process_view;
struct process_view_ordering {
bool operator()(process_view *a, process_view *b) const;
};
/*
* process_view: a process-level representation of
* how we'll render the process.
* This is independent of how we'll actually render it
* (i.e., Tcl, GNOME, etc.).
*/
class process_view {
friend class process_view_ordering;
private:
process_view(const process_view& tb);
process_view& operator=(const process_view& tb);
protected:
process_model *pm_;
blob *b_;
// keep an ordering of processes
typedef set<process_view *, process_view_ordering> process_view_order_t;
static process_view_order_t orders_;
process_view_order_t::iterator order_;
void reorder();
// static stuff:
double H_, S_, B_;
// int start_x_, start_y_;
struct memory_sum_t { static int sum_; };
sum_change_tracking<int,memory_sum_t> size_;
void reset_size();
change_tracking<int> time_;
change_tracking<int> age_;
static const int size_recalc_divisor_ = 8;
static change_tracking<int> size_divisor_;
static int size_low_water_, size_high_water_;
static double size_target_multiplier_;
int scale_size(int size);
static const int time_divisor_ = 10; // msec->100ths of a sec
int scale_time(int time);
void reset_color();
void init_position();
public:
process_view(process_model *pm);
~process_view();
void update();
void info_to_buf(char *buf, int buflen);
int pid();
blob *get_blob() { return b_; }
process_view *superior();
static int show_size_;
static void autosize();
static void mem_adjust(int dir);
static void mem_target_adjust(int dir);
};
#endif /* lavaps_process_view_h */
|