Darren Hart a e'crit :
> Gilles Carry wrote:
>> --- a/testcases/realtime/include/libstats.h
>> +++ b/testcases/realtime/include/libstats.h
>> @@ -45,6 +45,10 @@
>>  #include <errno.h>
>>  #include <unistd.h>
>>  #include <math.h>
>> +#include <librttest.h>
> 
> Hrm, seems odd to require this include to dump to XML.  Why do we need it?

I check this again and let you know.


>>  typedef struct stats_record {
>>      long x;
>>      long y;
>> +    nsec_t t; /* timestamp */
>> +    int c; /* cpu id */
> 
> hrm... thinking...
> 
> I like getting the timestamp regardless of if xml is used.  Will watch 
> for arch issues below re the cpu id.  Also, x and y were short names 
> because it was sufficient to identify their purpose, let's use more 
> descriptive names for t and c, like timestamp and cpu, then you won't 
> need the comments and the code where it's used will be self evident.

Ok. I change the names.

Actually I added timestamp to spot bursts of abnormal delays on one 
test. The generated graph showed a comb from which I could tell the 
bursts frequency.
With cpuid, I could tell the abnormal delays were spread among all cpus. 
A 3D graph was useful here. Thanks to gnuplot.


>> +
>> +    xml_start_tag(xs, "stats");
>> +    minx = maxx = data->records[0].x;
>> +    miny = maxy = data->records[0].y;
>> +    xml_entry(xs, "title",title);
>> +    xml_entry(xs, "xlabel",xlabel);
>> +    xml_entry(xs, "ylabel",ylabel);
>> +    xml_entry(xs, "mode",mode);
>> +    xml_start_tag(xs, "data");
>> +
>> +    for (i = 0; i < data->size; i++) {
>> +            rec = &data->records[i];
>> +            minx = MIN(minx, rec->x);
>> +            maxx = MAX(maxx, rec->x);
>> +            miny = MIN(miny, rec->y);
>> +            maxy = MAX(maxy, rec->y);
>> +
>> +            xml_start_tag(xs, "e");
> 
> "e" ?  Seems to me one of the purposes of using xml is to generate human 
> readable output.  "e" doesn't say much about what the tag contains.


Using an initial is just a way to make the output file smaller as there 
may be millions of records.
Tell me what you want.

> 
>> +            xml_entry(xs, "r", "%d", i);
>> +            xml_entry(xs, "x", "%ld", rec->x);
>> +            xml_entry(xs, "y", "%ld", rec->y);
>> +            xml_entry(xs, "t", "%lld", rec->t);
>> +            xml_entry(xs, "c", "%d", rec->c);
> 
>  From a purely xml point of view, all of these things look a lot more 
> like attributes than CDATA.  What do you think about using xml attrs 
> rather than CDATA?  perhaps using something like:

I have no preference over here.
It would just change the prost-processing xqueries. Not big deal.

> 
> Also, I think xml_entry() and xml_empty_tag() are confusing. 
> xml_entry() is actually a tag every bit as much as the others, so why 
> not stick with the same term?

What name do you suggest for xml_empty_tag?

> 
> We might be able to use something with vargs to add attributes to an 
> xml_tag() call.... Thoughts?

Yes, just by adding vargs to xml_tag_start and xml_empty_tag.
Prototype would be:
void xml_start_tag (xml_stream_t *xs, char *tagname, char *attr_fmt, ...);

How about this:
1) have xml_start_tag and xml_empty_tag have vargs for attributes
2) create a new function: xml_content (which just vfprintf into the stream)
3) suppress xml_entry and instead, let programmer do:
        xml_start_tag
        xml_content
        xml_end_tag
?

Thoughts?

Gilles.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to