Hi,
In a lot of cases, we do not really care about the samples and histogram
files and their associated gnuplot command files or do not want to save them
for example on embedded platforms with limited or no storage.
This patch disables generating those files by default and introduce a new
parameter to the tests, namely '-s', for when we really want to.
Sebastien.
Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
Cc: Darren Hart <[EMAIL PROTECTED]>
Cc: Tim Chavez <[EMAIL PROTECTED]>
Cc: Robert Schwebel <[EMAIL PROTECTED]>
---
testcases/realtime/include/libstats.h | 2 ++
testcases/realtime/lib/librttest.c | 6 +++++-
testcases/realtime/lib/libstats.c | 5 +++++
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/testcases/realtime/include/libstats.h
b/testcases/realtime/include/libstats.h
index d498d3a..2e9e5be 100644
--- a/testcases/realtime/include/libstats.h
+++ b/testcases/realtime/include/libstats.h
@@ -71,6 +71,8 @@ typedef struct stats_quantiles {
long *quantiles;
} stats_quantiles_t;
+extern int save_stats;
+
/* function prototypes */
/* stats_container_init - allocate memory for a new container
diff --git a/testcases/realtime/lib/librttest.c
b/testcases/realtime/lib/librttest.c
index 5e915eb..6981376 100644
--- a/testcases/realtime/lib/librttest.c
+++ b/testcases/realtime/lib/librttest.c
@@ -41,6 +41,7 @@
*****************************************************************************/
#include <librttest.h>
+#include <libstats.h>
#include <stdio.h>
#include <stdlib.h>
@@ -76,6 +77,7 @@ void rt_help(void)
printf(" -b(0,1) 1:enable buffered output, 0:diable buffered
output\n");
printf(" -p(0,1) 0:don't use pi mutexes, 1:use pi mutexes\n");
printf(" -v[0-4] 0:no debug, 1:DBG_ERR, 2:DBG_WARN, 3:DBG_INFO,
4:DBG_DEBUG\n");
+ printf(" -s Enable saving stats data (default disabled)\n");
}
int rt_init(const char *options, int (*parse_arg)(int option, char *value),
int argc, char *argv[])
@@ -85,7 +87,7 @@ int rt_init(const char *options, int (*parse_arg)(int option,
char *value), int
int c;
opterr = 0;
char *all_options, *opt_ptr;
- static const char my_options[] = "b:p:v:";
+ static const char my_options[] = "b:p:v:s";
if (options) {
opt_ptr = all_options = (char *)malloc(sizeof(my_options) +
strlen(options) + 1);
@@ -117,6 +119,8 @@ int rt_init(const char *options, int (*parse_arg)(int
option, char *value), int
case 'v':
_dbg_lvl = atoi(optarg);
break;
+ case 's':
+ save_stats = 1;
default:
if (parse_arg) {
if (!parse_arg(c, optarg)) {
diff --git a/testcases/realtime/lib/libstats.c
b/testcases/realtime/lib/libstats.c
index a5f876a..b392b22 100644
--- a/testcases/realtime/lib/libstats.c
+++ b/testcases/realtime/lib/libstats.c
@@ -44,6 +44,8 @@
#include <math.h>
#include <libstats.h>
+int save_stats = 0;
+
/* static helper functions */
static int stats_record_compare(const void * a, const void * b) {
int ret = 0;
@@ -299,6 +301,9 @@ int stats_container_save(char *filename, char *title, char
*xlabel, char *ylabel
char *pltfile;
stats_record_t *rec;
+ if (!save_stats)
+ return 0;
+
/* generate the filenames */
if (!asprintf(&datfile, "%s.dat", filename) < 0) {
fprintf(stderr, "Failed to allocate string for data
filename\n");
--
1.5.4.rc2.84.gf85fd-dirty
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list