-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathma_draw_histogram.e
More file actions
89 lines (72 loc) · 2.73 KB
/
ma_draw_histogram.e
File metadata and controls
89 lines (72 loc) · 2.73 KB
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
note
description: "Draw the histogram of the memory useage at a time."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date: 2008-12-29 21:27:11 +0100 (mån, 29 dec 2008) $"
revision: "$Revision: 76420 $"
class
MA_DRAW_HISTOGRAM
inherit
MA_DRAW_STATISTIC
redefine
draw_text
end
create
make_default
feature {NONE}-- Initlization
make_default
-- creation method
do
graph_height := 80
graph_width := 120
right_interval := 40
bottom_interval := 30
create internal_pixmap.make_with_size (graph_width, graph_height)
internal_pixmap.set_background_color (graph_pixmap_background_color)
end
feature -- Command
draw_graph (a_used_percent, a_overhead_percent: DOUBLE)
-- Do draw_pixmap.
do
internal_pixmap.set_foreground_color (graph_pixmap_background_color)
internal_pixmap.fill_rectangle (0, 0, internal_pixmap.width, internal_pixmap.height)
draw_histogram (a_used_percent, a_overhead_percent)
end
draw_text (a_info: STRING)
-- draw the text which is a number of current statistic
do
internal_pixmap.set_foreground_color (graph_text_color)
internal_pixmap.draw_text (0, graph_height - bottom_interval + internal_pixmap.font.height, a_info)
end
feature {NONE} -- Implementation
draw_histogram (used_percent, overhead_percent: DOUBLE)
-- Draw the graph for eiffel/c/total memory useage.
require
used_percent_valid: used_percent >= 0 and used_percent <= 1
overhead_percent_valid: overhead_percent >= 0 and overhead_percent <= 1
local
test: INTEGER
do
-- eiffel_mem_percent := eiffel_mem_info.total/total_mem_info.total--whether show the graph base on the percent?
--draw background color
internal_pixmap.set_foreground_color (graph_inner_background_color)
internal_pixmap.fill_rectangle (left_top_x, left_top_y, inner_graph_width, inner_graph_height)
--draw used
internal_pixmap.set_foreground_color (graph_used_color)
test := inner_graph_draw_height_y (used_percent)
internal_pixmap.fill_rectangle (left_top_x, inner_graph_draw_height_y (used_percent), inner_graph_width, inner_graph_draw_height(used_percent))
--draw overhead
internal_pixmap.set_foreground_color (graph_overhead_color)
internal_pixmap.fill_rectangle (left_top_x, inner_graph_draw_height_y (overhead_percent), inner_graph_width, inner_graph_draw_height(overhead_percent))
end
note
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end