static int greyjobs = 0;
static int count_statistics = 1;
static int count_server_stats = 1;
-static char *server_stats_file = NULL;
+static char *stats_file_prefix = NULL;
static int hardJobsLimit = 0;
static int hardEventsLimit = 0;
static int hardRespSizeLimit = 0;
{"notif-il-fprefix", 1, NULL, 'Y'},
{"count-statistics", 1, NULL, 'T'},
{"count-server-stats", 1, NULL, 'e'},
- {"server-stats-file", 1, NULL, 'f'},
+ {"statistics-prefix", 1, NULL, 'f'},
{"request-timeout", 1, NULL, 't'},
#ifdef LB_PERF
{"perf-sink", 1, NULL, 'K'},
"\t--count-server-stats=0\t do not count server statistics\n"
"\t =1\t count server statistics (default)\n"
"\t =2\t count server statistics, restrict access only to superusers\n"
- "\t--server-stats-file path to file where server statistics are persistently stored\n"
+ "\t--statistics-prefix statistics persistency files full-path prefix\n"
"\t-t, --request-timeout\t request timeout for one client\n"
#ifdef LB_PERF
"\t-K, --perf-sink\t where to sink events\n"
break;
case 'e': count_server_stats = atoi(optarg);
break;
- case 'f': server_stats_file = strdup(optarg);
+ case 'f': stats_file_prefix = strdup(optarg);
break;
case 't': request_timeout = atoi(optarg);
break;
if (count_statistics) edg_wll_InitStatistics(ctx);
- if (count_server_stats) edg_wll_InitServerStatistics(ctx, server_stats_file);
+ if (count_server_stats) edg_wll_InitServerStatistics(ctx, stats_file_prefix);
edg_wll_FreeContext(ctx);
static int stats_in_tmp = 0;
static int msync_counter = 0;
-int edg_wll_InitServerStatistics(edg_wll_Context ctx, char *file)
+int edg_wll_InitServerStatistics(edg_wll_Context ctx, char *prefix)
{
//TODO get file name from command line
char *fname;
- char *lblocenv = NULL;
- if (file)
- asprintf(&fname, "%s", file);
- else{
-
- if (! (lblocenv = getenv("GLITE_LB_LOCATION_VAR"))) {
+/* if (prefix)
+ asprintf(&fname, "%s/lb_server_stats", file);
+ else{*/
+ if (! prefix){
+ if (! (prefix = getenv("GLITE_LB_LOCATION_VAR"))) {
struct stat info;
if (stat("/var/glite", &info) == 0 && S_ISDIR(info.st_mode))
- asprintf(&fname, "/var/glite/lb_server_stats");
+ asprintf(&prefix, "/var/glite/");
else {
- asprintf(&fname, "/tmp/lb_server_stats");
+ asprintf(&prefix, "/tmp/");
stats_in_tmp = 1;
}
glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_INFO,
- "server stats file not configured, using default %s", fname);
+ "server stats file not configured, using default %s/lb_server_stats", prefix);
}
- else
- asprintf(&fname, "%s/lb_server_stats", lblocenv);
}
+ asprintf(&fname, "%s/lb_server_stats", prefix);
serverStatisticsFD = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (serverStatisticsFD < 0){
serverStatisticsFD = open("/tmp/lb_server_stats", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);