~woodrow-shen/powertop/master.dd0c258

« back to all changes in this revision

Viewing changes to src/report/report-data-html.cpp

  • Committer: Woodrow Shen
  • Date: 2015-08-17 05:28:06 UTC
  • Revision ID: woodrow.shen@canonical.com-20150817052806-7t1bfmolizzuui9j
Tags: upstream-8.0
ImportĀ upstreamĀ versionĀ 8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "report-data-html.h"
 
2
 
 
3
void init_div(struct tag_attr *div_attr, const char *css_class, const char *css_id)
 
4
{
 
5
        div_attr->css_class=css_class;
 
6
        div_attr->css_id=css_id;
 
7
}
 
8
 
 
9
void
 
10
init_top_table_attr(struct table_attributes *table_css, int rows, int cols){
 
11
        table_css->pos_table_title=L;
 
12
        table_css->table_class="emphasis1";
 
13
        table_css->th_class="table_sysinfo";
 
14
        table_css->td_class="";
 
15
        table_css->tr_class="";
 
16
        table_css->title_mod=0;
 
17
        table_css->rows=rows;
 
18
        table_css->cols=cols;
 
19
}
 
20
 
 
21
void init_title_attr(struct tag_attr *title_attr)
 
22
{
 
23
        title_attr->css_class="content_title";
 
24
        title_attr->css_id="";
 
25
}
 
26
 
 
27
void init_std_table_attr(struct table_attributes *table_css, int rows, int cols){
 
28
        table_css->table_class="emphasis2";
 
29
        table_css->tr_class="emph1";
 
30
        table_css->th_class="emph_title";
 
31
        table_css->td_class="";
 
32
        table_css->pos_table_title=T;
 
33
        table_css->title_mod=0;
 
34
        table_css->rows=rows;
 
35
        table_css->cols=cols;
 
36
}
 
37
void init_std_side_table_attr(struct table_attributes *table_css, int rows, int cols){
 
38
        table_css->table_class="emphasis2 side_by_side_left";
 
39
        table_css->tr_class="emph1";
 
40
        table_css->th_class="emph_title";
 
41
        table_css->td_class="";
 
42
        table_css->pos_table_title=T;
 
43
        table_css->title_mod=0;
 
44
        table_css->rows=rows;
 
45
        table_css->cols=cols;
 
46
}
 
47
 
 
48
 
 
49
void init_pkg_table_attr(struct table_attributes *table_css, int rows, int cols){
 
50
        table_css->table_class="emphasis2 side_by_side_left";
 
51
        table_css->tr_class="";
 
52
        table_css->th_class="title";
 
53
        table_css->td_class="package";
 
54
        table_css->pos_table_title=T;
 
55
        table_css->title_mod=0;
 
56
        table_css->rows=rows;
 
57
        table_css->cols=cols;
 
58
}
 
59
 
 
60
void init_core_table_attr(struct table_attributes *table_css, int title_mod,
 
61
                int rows, int cols){
 
62
        table_css->table_class="emphasis2 side_by_side_left";
 
63
        table_css->tr_class="";
 
64
        table_css->th_class="title";
 
65
        table_css->td_class="core";
 
66
        table_css->pos_table_title=TC;
 
67
        table_css->title_mod=title_mod;
 
68
        table_css->rows=rows;
 
69
        table_css->cols=cols;
 
70
}
 
71
 
 
72
void init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
 
73
                int rows, int cols){
 
74
        table_css->table_class="emphasis2 side_by_side_left";
 
75
        table_css->tr_class="";
 
76
        table_css->th_class="title";
 
77
        table_css->td_class="cpu";
 
78
        table_css->pos_table_title=TLC;
 
79
        table_css->title_mod=title_mod;
 
80
        table_css->rows=rows;
 
81
        table_css->cols=cols;
 
82
}
 
83
 
 
84
 
 
85
void init_nowarp_table_attr(struct table_attributes *table_css, int rows, int cols){
 
86
        table_css->table_class="emphasis2";
 
87
        table_css->tr_class="emph1";
 
88
        table_css->th_class="emph_title";
 
89
        table_css->td_class="no_wrap";
 
90
        table_css->pos_table_title=T;
 
91
        table_css->title_mod=0;
 
92
        table_css->rows=rows;
 
93
        table_css->cols=cols;
 
94
}
 
95
 
 
96
void init_tune_table_attr(struct table_attributes *table_css, int rows, int cols){
 
97
        table_css->table_class="emphasis2";
 
98
        table_css->tr_class="tune";
 
99
        table_css->th_class="emph_title";
 
100
        table_css->td_class="";
 
101
        table_css->pos_table_title=T;
 
102
        table_css->rows=rows;
 
103
        table_css->cols=cols;
 
104
}
 
105
 
 
106
/* Other Helper Functions */
 
107
string
 
108
double_to_string(double dval)
 
109
{
 
110
        ostringstream dtmp;
 
111
        string str;
 
112
        dtmp << dval;
 
113
        str= dtmp.str();
 
114
        str = str.substr(0, str.find(".")+2);
 
115
        return str;
 
116
}
 
117
 
 
118