diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:00:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:00:20 +0000 |
commit | fcb4cb5c3d0fec0fede160d565134d553d783fb2 (patch) | |
tree | 7be42535554ca6badc1847d83ef123f4dc3c5506 /src/report/report-data-html.cpp | |
parent | Initial commit. (diff) | |
download | powertop-fcb4cb5c3d0fec0fede160d565134d553d783fb2.tar.xz powertop-fcb4cb5c3d0fec0fede160d565134d553d783fb2.zip |
Adding upstream version 2.15.upstream/2.15upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/report/report-data-html.cpp')
-rw-r--r-- | src/report/report-data-html.cpp | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/src/report/report-data-html.cpp b/src/report/report-data-html.cpp new file mode 100644 index 0000000..d9b713e --- /dev/null +++ b/src/report/report-data-html.cpp @@ -0,0 +1,128 @@ +#include "report-data-html.h" + +void init_div(struct tag_attr *div_attr, const char *css_class, const char *css_id) +{ + div_attr->css_class=css_class; + div_attr->css_id=css_id; +} + +void +init_top_table_attr(struct table_attributes *table_css, int rows, int cols){ + table_css->pos_table_title=L; + table_css->table_class="emphasis1"; + table_css->th_class="table_sysinfo"; + table_css->td_class=""; + table_css->tr_class=""; + table_css->title_mod=0; + table_css->rows=rows; + table_css->cols=cols; +} + +void init_title_attr(struct tag_attr *title_attr) +{ + title_attr->css_class="content_title"; + title_attr->css_id=""; +} + +void init_std_table_attr(struct table_attributes *table_css, int rows, int cols){ + table_css->table_class="emphasis2"; + table_css->tr_class="emph1"; + table_css->th_class="emph_title"; + table_css->td_class=""; + table_css->pos_table_title=T; + table_css->title_mod=0; + table_css->rows=rows; + table_css->cols=cols; +} +void init_std_side_table_attr(struct table_attributes *table_css, int rows, int cols){ + table_css->table_class="emphasis2 side_by_side_left"; + table_css->tr_class="emph1"; + table_css->th_class="emph_title"; + table_css->td_class=""; + table_css->pos_table_title=T; + table_css->title_mod=0; + table_css->rows=rows; + table_css->cols=cols; +} + + +void init_pkg_table_attr(struct table_attributes *table_css, int rows, int cols){ + table_css->table_class="emphasis2 side_by_side_left"; + table_css->tr_class=""; + table_css->th_class="title"; + table_css->td_class="package"; + table_css->pos_table_title=T; + table_css->title_mod=0; + table_css->rows=rows; + table_css->cols=cols; +} + +void init_core_table_attr(struct table_attributes *table_css, int title_mod, + int rows, int cols){ + table_css->table_class="emphasis2 side_by_side_left"; + table_css->tr_class=""; + table_css->th_class="title"; + table_css->td_class="core"; + table_css->pos_table_title=TC; + table_css->title_mod=title_mod; + table_css->rows=rows; + table_css->cols=cols; +} + +void init_cpu_table_attr(struct table_attributes *table_css, int title_mod, + int rows, int cols){ + table_css->table_class="emphasis2 side_by_side_left"; + table_css->tr_class=""; + table_css->th_class="title"; + table_css->td_class="cpu"; + table_css->pos_table_title=TLC; + table_css->title_mod=title_mod; + table_css->rows=rows; + table_css->cols=cols; +} + + +void init_nowarp_table_attr(struct table_attributes *table_css, int rows, int cols){ + table_css->table_class="emphasis2"; + table_css->tr_class="emph1"; + table_css->th_class="emph_title"; + table_css->td_class="no_wrap"; + table_css->pos_table_title=T; + table_css->title_mod=0; + table_css->rows=rows; + table_css->cols=cols; +} + +void init_tune_table_attr(struct table_attributes *table_css, int rows, int cols){ + table_css->table_class="emphasis2"; + table_css->tr_class="tune"; + table_css->th_class="emph_title"; + table_css->td_class=""; + table_css->pos_table_title=T; + table_css->rows=rows; + table_css->cols=cols; +} + +void init_wakeup_table_attr(struct table_attributes *table_css, int rows, int cols){ + table_css->table_class="emphasis2"; + table_css->tr_class="tune"; + table_css->th_class="emph_title"; + table_css->td_class=""; + table_css->pos_table_title=T; + table_css->rows=rows; + table_css->cols=cols; +} + +/* Other Helper Functions */ +string +double_to_string(double dval) +{ + ostringstream dtmp; + string str; + dtmp << dval; + str= dtmp.str(); + str = str.substr(0, str.find(".")+2); + return str; +} + + |