From: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH v3 19/31] report: redesign Software Information csv and html
Date: Tue, 10 Dec 2013 23:14:46 +0300 [thread overview]
Message-ID: <20131210201446.GD2422@swordfish> (raw)
In-Reply-To: 1384806442-20294-20-git-send-email-alexandra.yates@linux.intel.com
[-- Attachment #1: Type: text/plain, Size: 7010 bytes --]
On (11/18/13 12:27), Alexandra Yates wrote:
> Enabled "Overview of Software Power Consumers" section
> for csv and html report redesign, while preserving
> translation macros.
>
> Signed-off-by: Alexandra Yates <alexandra.yates(a)linux.intel.com>
> ---
> src/process/do_process.cpp | 113 ++++++++++++++++++++++-----------------
> src/report/report-data-html.cpp | 11 +++-
> src/report/report-data-html.h | 2 +
> 3 files changed, 77 insertions(+), 49 deletions(-)
>
> diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp
> index c676978..6fc7a5b 100644
> --- a/src/process/do_process.cpp
> +++ b/src/process/do_process.cpp
> @@ -889,42 +889,48 @@ void report_process_update_display(void)
> {
> unsigned int i;
> unsigned int total;
> + int show_power, cols, rows, idx;
>
> - int show_power;
> -
> - sort(all_power.begin(), all_power.end(), power_cpu_sort);
> -
> - show_power = global_power_valid();
> + /* div attr css_class and css_id */
> + tag_attr div_attr;
> + init_div(&div_attr, "clear_block", "software");
>
> - report.begin_section(SECTION_SOFTWARE);
> - report.add_header(__("Overview of Software Power Consumers"));
> - report.begin_table(TABLE_WIDE);
> - report.begin_row();
> - if (show_power) {
> - report.begin_cell(CELL_SOFTWARE_HEADER);
> - report.add(__("Power est."));
> - }
> + /* Set Table attributes, rows, and cols */
> + cols=7;
> + if (show_power)
> + cols=8;
>
> - report.begin_cell(CELL_SOFTWARE_HEADER);
> - report.add(__("Usage"));
> - report.begin_cell(CELL_SOFTWARE_HEADER);
> - report.add(__("Wakeups/s"));
> - report.begin_cell(CELL_SOFTWARE_HEADER);
> - report.add(__("GPU ops/s"));
> - report.begin_cell(CELL_SOFTWARE_HEADER);
> - report.add(__("Disk IO/s"));
> - report.begin_cell(CELL_SOFTWARE_HEADER);
> - report.add(__("GFX Wakeups/s"));
> - report.begin_cell(CELL_SOFTWARE_PROCESS);
> - report.add(__("Category"));
> - report.begin_cell(CELL_SOFTWARE_DESCRIPTION);
> - report.add(__("Description"));
> + idx=cols;
>
> total = all_power.size();
> -
> if (total > 100)
> total = 100;
>
> + rows=total+1;
> + table_attributes std_table_css;
> + init_nowarp_table_attr(&std_table_css, rows, cols);
> +
> +
> + /* Set Title attributes */
> + tag_attr title_attr;
> + init_title_attr(&title_attr);
> +
> + /* Set array of data in row Major order */
> + string software_data[cols * rows];
> + software_data[0]=__("Usage");
> + software_data[1]=__("Wakeups/s");
> + software_data[2]=__("GPU ops/s");
> + software_data[3]=__("Disk IO/s");
> + software_data[4]=__("GFX Wakeups/s");
> + software_data[5]=__("Category");
> + software_data[6]=__("Description");
> +
> + if (show_power)
> + software_data[7]=__("PW Estimate");
> +
> + sort(all_power.begin(), all_power.end(), power_cpu_sort);
> + show_power = global_power_valid();
> +
> for (i = 0; i < total; i++) {
> char power[16];
> char name[20];
> @@ -943,7 +949,8 @@ void report_process_update_display(void)
> if (strcmp(name, "Device") == 0)
> continue;
>
> - if (all_power[i]->events() == 0 && all_power[i]->usage() == 0 && all_power[i]->Witts() == 0)
> + if (all_power[i]->events() == 0 && all_power[i]->usage() == 0
> + && all_power[i]->Witts() == 0)
> break;
>
> usage[0] = 0;
> @@ -958,7 +965,7 @@ void report_process_update_display(void)
> sprintf(wakes, "%5.2f", all_power[i]->wake_ups / measurement_time);
> sprintf(gpus, "%5.1f", all_power[i]->gpu_ops / measurement_time);
> sprintf(disks, "%5.1f (%5.1f)", all_power[i]->hard_disk_hits / measurement_time,
> - all_power[i]->disk_hits / measurement_time);
> + all_power[i]->disk_hits / measurement_time);
> sprintf(xwakes, "%5.1f", all_power[i]->xwakes / measurement_time);
> if (!all_power[i]->show_events()) {
> wakes[0] = 0;
> @@ -975,27 +982,37 @@ void report_process_update_display(void)
> if (all_power[i]->xwakes == 0)
> xwakes[0] = 0;
>
> - report.begin_row(ROW_SOFTWARE);
> + software_data[idx]=string(usage);
> + idx+=1;
> +
> + software_data[idx]=string(wakes);
> + idx+=1;
> +
> + software_data[idx]=string(gpus);
> + idx+=1;
> +
> + software_data[idx]=string(disks);
> + idx+=1;
> +
> + software_data[idx]=string(xwakes);
> + idx+=1;
> +
> + software_data[idx]=string(name);
> + idx+=1;
/** just a side note*/
I think C++ can help us. we can just declare std::vector and push_back().
-ss
> + software_data[idx]=string(pretty_print(all_power[i]->description(), descr, 128));
> + idx+=1;
> if (show_power) {
> - report.begin_cell(CELL_SOFTWARE_POWER);
> - report.add(power);
> + software_data[idx]=string(power);
> + idx+=1;
> }
> -
> - report.begin_cell(CELL_SOFTWARE_POWER);
> - report.add(usage);
> - report.begin_cell(CELL_SOFTWARE_POWER);
> - report.add(wakes);
> - report.begin_cell(CELL_SOFTWARE_POWER);
> - report.add(gpus);
> - report.begin_cell(CELL_SOFTWARE_POWER);
> - report.add(disks);
> - report.begin_cell(CELL_SOFTWARE_POWER);
> - report.add(xwakes);
> - report.begin_cell();
> - report.add(name);
> - report.begin_cell();
> - report.add(pretty_print(all_power[i]->description(), descr, 128));
> }
> +
> + /* Report Output */
> + report.add_div(&div_attr);
> + report.add_title(&title_attr, __("Overview of Software Power Consumers"));
> + report.add_table(software_data, &std_table_css);
> + report.end_div();
> }
>
> void report_summary(void)
> diff --git a/src/report/report-data-html.cpp b/src/report/report-data-html.cpp
> index 28732c9..f0d536d 100644
> --- a/src/report/report-data-html.cpp
> +++ b/src/report/report-data-html.cpp
> @@ -71,7 +71,16 @@ void init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
> }
>
>
> -
> +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;
> +}
>
>
> /* Other Helper Functions */
> diff --git a/src/report/report-data-html.h b/src/report/report-data-html.h
> index 61e75c0..d2d782b 100644
> --- a/src/report/report-data-html.h
> +++ b/src/report/report-data-html.h
> @@ -53,6 +53,8 @@ init_core_table_attr(struct table_attributes *table_css, int title_mod,
> void
> init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
> int rows, int cols);
> +void
> +init_nowarp_table_attr(struct table_attributes *table_css, int rows, int cols);
>
>
> /* Other helper functions */
> --
> 1.7.9.5
>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
>
next reply other threads:[~2013-12-10 20:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 20:14 Sergey Senozhatsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-11-18 20:27 [Powertop] [PATCH v3 19/31] report: redesign Software Information csv and html Alexandra Yates
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131210201446.GD2422@swordfish \
--to=powertop@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.