* tools: fix several problems in gtracestat
@ 2011-03-03 10:22 Wei, Gang
2011-03-03 17:16 ` Ian Jackson
0 siblings, 1 reply; 5+ messages in thread
From: Wei, Gang @ 2011-03-03 10:22 UTC (permalink / raw)
To: xen-devel@lists.xensource.com; +Cc: Ian Jackson, Wei, Gang, Stefano Stabellini
[-- Attachment #1: Type: text/plain, Size: 3570 bytes --]
tools: fix several problems in gtracestat
Fixed problems include:
* previously just print out a error instead of help info while running without cmdline parameters.
* -u & -n lead to Segmentation fault.
* -c and then use default ranges, the default ranges is not 50us... but 50000/tsc2us....
Signed-off-by: Wei Gang <gang.wei@intel.com>
diff -r e7b31cc0093c tools/misc/gtracestat.c
--- a/tools/misc/gtracestat.c Mon Jan 31 17:46:55 2011 +0000
+++ b/tools/misc/gtracestat.c Fri Mar 04 23:50:16 2011 +0800
@@ -137,9 +137,13 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0 },
};
+ if ( argc == 1 ) {
+ show_help();
+ exit(EXIT_SUCCESS);
+ }
while (1) {
int ch, opt_idx;
- ch = getopt_long(argc, argv, "vhds:e:l:bcmaupnzx",
+ ch = getopt_long(argc, argv, "vhds:e:l:bcmau:pn:zx",
long_options, &opt_idx);
if (ch == -1)
break;
@@ -435,13 +439,13 @@ int load_file(char *fname)
void show_version(void)
{
- printf("gtracestat - (C) 2009 Intel Corporation\n");
+ printf("gtracestat - (C) 2009-2011 Intel Corporation\n");
}
void show_help(void)
{
show_version();
- printf("tracestat <trace.data> [-vhdselbcmau]\n");
+ printf("gtracestat <trace.data> [-vhdselbcmau]\n");
printf(" trace.data raw data got by 'xentrace -e 0x80f000 trace.dat'\n");
printf(" -v / --version show version message\n");
printf(" -h / --help show this message\n");
@@ -453,9 +457,9 @@ void show_help(void)
printf(" -c / --count give count summary info\n");
printf(" -a / --average give total/average residency info\n");
printf(" -m / --maxmin show man/min residency summary info\n");
- printf(" -u / --tsc2us specify how many tsc is a us unit\n");
+ printf(" -u / --tsc2us <tsc-per-us> specify how many tsc is a us unit\n");
printf(" -p / --px operate on Px entries\n");
- printf(" -n / --tsc2phase specify how many tsc is a phase unit (only in px)\n");
+ printf(" -n / --tsc2phase <tsc-per-phase> specify how many tsc is a phase unit (only in px)\n");
printf(" -z / --exp-ratio show the ratio of early break events\n");
printf(" -x / --exp-pred show the ratio of expected / predicted in Cx entry\n");
}
@@ -745,21 +749,22 @@ void do_maxmin(void)
void do_count(void)
{
- uint64_t scale[100] = { 50000UL, 100000UL, 200000UL, 400000UL, 800000UL, 1000000UL };
- int a[100];
+ uint64_t scale[100] = { 50UL, 100UL, 200UL, 400UL, 800UL, 1000UL };
+ int a;
int scale_len = 6;
int len = 0;
int i, j;
printf("Please input the period: (Ctrl+D to quit)\n");
- printf("The default is 50us, 100us, 200us, 400us, 800us, 1000us.\n(unit is us, you DO NOT need to add us and specify ZERO us and please be in INCREASING order.)\n");
- while (scanf("%d", &a[len]) == 1)
- len++;
- if (len) {
- for (i = 0; i < len; i++)
- scale[i] = a[i] * tsc2us;
+ printf("The default is: 50 100 200 400 800 1000\n"
+ "(unit is us, DO NOT specify ZERO as any entry, keep entries in INCREASING order.)\n");
+ while (scanf("%d", &a) == 1) {
+ scale[len++] = a;
scale_len = len;
}
+ for (i = 0; i < scale_len; i++)
+ scale[i] = scale[i] * tsc2us;
+
for (i = 0; i < max_cpu_num; i++) {
struct cond_rec *r[MAX_CX_NR];
uint64_t sum[MAX_CX_NR];
[-- Attachment #2: gtracestat-fix.patch --]
[-- Type: application/octet-stream, Size: 3484 bytes --]
tools: fix several problems in gtracestat
Fixed problems include:
* previously just print out a error instead of help info while running without cmdline parameters.
* -u & -n lead to Segmentation fault.
* -c and then use default ranges, the default ranges is not 50us... but 50000/tsc2us....
Signed-off-by: Wei Gang <gang.wei@intel.com>
diff -r e7b31cc0093c tools/misc/gtracestat.c
--- a/tools/misc/gtracestat.c Mon Jan 31 17:46:55 2011 +0000
+++ b/tools/misc/gtracestat.c Fri Mar 04 23:50:16 2011 +0800
@@ -137,9 +137,13 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0 },
};
+ if ( argc == 1 ) {
+ show_help();
+ exit(EXIT_SUCCESS);
+ }
while (1) {
int ch, opt_idx;
- ch = getopt_long(argc, argv, "vhds:e:l:bcmaupnzx",
+ ch = getopt_long(argc, argv, "vhds:e:l:bcmau:pn:zx",
long_options, &opt_idx);
if (ch == -1)
break;
@@ -435,13 +439,13 @@ int load_file(char *fname)
void show_version(void)
{
- printf("gtracestat - (C) 2009 Intel Corporation\n");
+ printf("gtracestat - (C) 2009-2011 Intel Corporation\n");
}
void show_help(void)
{
show_version();
- printf("tracestat <trace.data> [-vhdselbcmau]\n");
+ printf("gtracestat <trace.data> [-vhdselbcmau]\n");
printf(" trace.data raw data got by 'xentrace -e 0x80f000 trace.dat'\n");
printf(" -v / --version show version message\n");
printf(" -h / --help show this message\n");
@@ -453,9 +457,9 @@ void show_help(void)
printf(" -c / --count give count summary info\n");
printf(" -a / --average give total/average residency info\n");
printf(" -m / --maxmin show man/min residency summary info\n");
- printf(" -u / --tsc2us specify how many tsc is a us unit\n");
+ printf(" -u / --tsc2us <tsc-per-us> specify how many tsc is a us unit\n");
printf(" -p / --px operate on Px entries\n");
- printf(" -n / --tsc2phase specify how many tsc is a phase unit (only in px)\n");
+ printf(" -n / --tsc2phase <tsc-per-phase> specify how many tsc is a phase unit (only in px)\n");
printf(" -z / --exp-ratio show the ratio of early break events\n");
printf(" -x / --exp-pred show the ratio of expected / predicted in Cx entry\n");
}
@@ -745,21 +749,22 @@ void do_maxmin(void)
void do_count(void)
{
- uint64_t scale[100] = { 50000UL, 100000UL, 200000UL, 400000UL, 800000UL, 1000000UL };
- int a[100];
+ uint64_t scale[100] = { 50UL, 100UL, 200UL, 400UL, 800UL, 1000UL };
+ int a;
int scale_len = 6;
int len = 0;
int i, j;
printf("Please input the period: (Ctrl+D to quit)\n");
- printf("The default is 50us, 100us, 200us, 400us, 800us, 1000us.\n(unit is us, you DO NOT need to add us and specify ZERO us and please be in INCREASING order.)\n");
- while (scanf("%d", &a[len]) == 1)
- len++;
- if (len) {
- for (i = 0; i < len; i++)
- scale[i] = a[i] * tsc2us;
+ printf("The default is: 50 100 200 400 800 1000\n"
+ "(unit is us, DO NOT specify ZERO as any entry, keep entries in INCREASING order.)\n");
+ while (scanf("%d", &a) == 1) {
+ scale[len++] = a;
scale_len = len;
}
+ for (i = 0; i < scale_len; i++)
+ scale[i] = scale[i] * tsc2us;
+
for (i = 0; i < max_cpu_num; i++) {
struct cond_rec *r[MAX_CX_NR];
uint64_t sum[MAX_CX_NR];
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: tools: fix several problems in gtracestat
2011-03-03 10:22 tools: fix several problems in gtracestat Wei, Gang
@ 2011-03-03 17:16 ` Ian Jackson
2011-03-03 17:28 ` Ian Campbell
2011-03-03 17:37 ` Re: tools: fix several problems in gtracestat Keir Fraser
0 siblings, 2 replies; 5+ messages in thread
From: Ian Jackson @ 2011-03-03 17:16 UTC (permalink / raw)
To: Wei, Gang; +Cc: xen-devel@lists.xensource.com, Stabellini
Wei, Gang writes ("tools: fix several problems in gtracestat"):
> tools: fix several problems in gtracestat
Thanks. This looks plausible, and it compiles.
I am happy to apply this to 4.1, given its very limited scope. In
accordance with our code freeze I'd like an ack from another
maintainer before I apply it.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Re: tools: fix several problems in gtracestat
2011-03-03 17:16 ` Ian Jackson
@ 2011-03-03 17:28 ` Ian Campbell
2011-03-03 18:51 ` tools: fix several problems in gtracestat [and 2 more messages] Ian Jackson
2011-03-03 17:37 ` Re: tools: fix several problems in gtracestat Keir Fraser
1 sibling, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2011-03-03 17:28 UTC (permalink / raw)
To: Ian Jackson; +Cc: xen-devel@lists.xensource.com, Wei, Gang, Stefano Stabellini
On Thu, 2011-03-03 at 17:16 +0000, Ian Jackson wrote:
> Wei, Gang writes ("tools: fix several problems in gtracestat"):
> > tools: fix several problems in gtracestat
>
> Thanks. This looks plausible, and it compiles.
>
> I am happy to apply this to 4.1, given its very limited scope. In
> accordance with our code freeze I'd like an ack from another
> maintainer before I apply it.
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
I would have preferred three patches for the three bullet points in the
commit message but nevertheless:
Acked-by: Ian Campbell <ian.campbell@citrix.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Re: tools: fix several problems in gtracestat
2011-03-03 17:16 ` Ian Jackson
2011-03-03 17:28 ` Ian Campbell
@ 2011-03-03 17:37 ` Keir Fraser
1 sibling, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2011-03-03 17:37 UTC (permalink / raw)
To: Ian Jackson, Wei, Gang; +Cc: xen-devel@lists.xensource.com
On 03/03/2011 17:16, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:
> Wei, Gang writes ("tools: fix several problems in gtracestat"):
>> tools: fix several problems in gtracestat
>
> Thanks. This looks plausible, and it compiles.
>
> I am happy to apply this to 4.1, given its very limited scope. In
> accordance with our code freeze I'd like an ack from another
> maintainer before I apply it.
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
> Ian.
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-03-03 18:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-03 10:22 tools: fix several problems in gtracestat Wei, Gang
2011-03-03 17:16 ` Ian Jackson
2011-03-03 17:28 ` Ian Campbell
2011-03-03 18:51 ` tools: fix several problems in gtracestat [and 2 more messages] Ian Jackson
2011-03-03 17:37 ` Re: tools: fix several problems in gtracestat Keir Fraser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).