From: Igor Zhbanov <i.zhbanov at samsung.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] Support for printing report in text format in powertop2.x
Date: Wed, 29 Aug 2012 10:59:08 +0400 [thread overview]
Message-ID: <503DBDBC.1020801@samsung.com> (raw)
In-Reply-To: CAOh2x=nmJYnz1JT=m8KUU=Lj9iRn__Xt-uua9RReqfioXn+gOw@mail.gmail.com
[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]
Hi everyone!
Viresh Kumar wrote:
> I have following test case, i need to capture data using powertop
> for some time and then analyse it.
>
> There are two formats in which this is done as of today
> - html
> - csv
>
> I believe we must also have a plain text version for it. Any cons
> of that?
I agree with that. Also I think that report system with many places like:
if (html)
printf(something);
else
printf(nearly-the-same);
that needs to be redesigned. I use something like CSV-generator in my
yet to be merged MALI GPU support patch because generated CVS's doesn't
conform to any CSV standards: there are no quotes for empty values,
also quote symbols are not escaped inside the values. Commas are not escaped too. So it is impossible to parse generated CSV's with
traditional parsers.
I think that we could design generalized reporting system that could
output data in any desired format (HTML, CSV and probably TXT).
Since all results are contained inside the tables, that system could have interface like
create_report(type);
report.add_table(...);
report.add_column_name(const char *name, bool last_in_line = false);
report.add_column_val(const char *value, bool last_in_line = false);
report.get_result();
Now there are a lots of code like that:
if (reporttype)
fprintf(reportout.http_report,
"<tr class=\"%s\"><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td class=\"process_power\">%s</td><td>%s</td><td>%s</td></tr>\n",
process_class(lines), power, usage, events, name, pretty_print(all_power[i]->description(), descr, 128));
else
fprintf(reportout.csv_report,
"%s,%s,%s,%s,%s \n",
power, usage, events, name, pretty_print(all_power[i]->description(), descr, 128));
I think that we could separate CSV/HTML generation code from processing logic. What you think?
--
Best regards,
Igor Zhbanov,
Expert Software Engineer,
phone: +7 (495) 797 25 00 ext 3806
e-mail: i.zhbanov(a)samsung.com
ASWG, Moscow R&D center, Samsung Electronics
12 Dvintsev street, building 1
127018, Moscow, Russian Federation
next reply other threads:[~2012-08-29 6:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 6:59 Igor Zhbanov [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-08-30 16:12 [Powertop] Support for printing report in text format in powertop2.x Sergey Senozhatsky
2012-08-30 6:40 Igor Zhbanov
2012-08-29 21:15 Sergey Senozhatsky
2012-08-29 14:40 Igor Zhbanov
2012-08-29 14:28 Arjan van de Ven
2012-08-29 7:09 Bram Bouwens
2012-08-29 6:16 Viresh Kumar
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=503DBDBC.1020801@samsung.com \
--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.