Example #1
0
void denormalize_summary(struct rmDsummary *s)
{
	struct field *f;
	for(f = &fields[WALL_TIME]; f->name != NULL; f++)
	{
		if(f->active)
		{
			if(value_of_field(max_values, f) > 0)
				assign_to_field(s, f, value_of_field(s, f) * value_of_field(max_values, f));
		}
	}
}
Example #2
0
struct rmDsummary *summary_bin_op(struct rmDsummary *s, struct rmDsummary *a, struct rmDsummary *b, double (*op)(double, double))
{
	struct field *f;
	for(f = &fields[WALL_TIME]; f->name != NULL; f++)
	{
		if(f->active)
		{
			assign_to_field(s, f, op(value_of_field(a, f), value_of_field(b, f)));
		}
	}

	return s;
}
Example #3
0
void covariance_matrix_merge(struct cluster *c, struct cluster *left, struct cluster *right)
{
	enum fields row, col;
	struct rmDsummary *uA, *uB;

	double uxA, uxB;
	double uyA, uyB;
	double sA,  sB;
	int    nA,  nB;

	uA = left->centroid;
	uB = right->centroid;

	nA = left->count;
	nB = right->count;

	/* To NUM_FIELDS - 1 because we do not want RULE */
	for(row = 1; row < NUM_FIELDS; row++)
	{
		if(!(fields[row].active))
			continue;

		uxA = value_of_field(uA, &fields[row]);
		uxB = value_of_field(uB, &fields[row]);

		for(col = row; col < NUM_FIELDS; col++)
		{
			if(!(fields[col].active))
				continue;

			uyA = value_of_field(uA, &fields[col]);
			uyB = value_of_field(uB, &fields[col]);

			sA  = left->covariance[row][col];
			sB  = right->covariance[row][col];

			c->covariance[row][col] = covariance_scalar_merge(uxA, uyA, sA, nA, uxB, uyB, sB, nB);

			c->covariance[col][row] = c->covariance[row][col];
		}
	}
}
Example #4
0
struct rmDsummary *find_max_summary(struct list *summaries)
{
	struct rmDsummary *s;
	struct rmDsummary *max = calloc(1, sizeof(struct rmDsummary));

	list_first_item(summaries);
	while( (s = list_next_item(summaries)) )
	{
		struct field *f;
		for(f = &fields[WALL_TIME]; f->name != NULL; f++)
		{
			if(f->active)
			{
				if(value_of_field(max, f) < value_of_field(s, f))
					assign_to_field(max, f, value_of_field(s, f));
			}
		}
	}

	return max;
}
Example #5
0
void print_summary_file(FILE *stream, struct rmDsummary *s, int include_abbrev)
{

	struct field *f;
	for(f = &fields[WALL_TIME]; f->name != NULL; f++)
	{
		if(f->active)
		{
			fprintf(stream, "%s%6.3lf ", (include_abbrev) ? f->abbrev : "", value_of_field(s, f));
		}
	}

	fprintf(stream, "\n");
}
Example #6
0
double summary_accumulate(struct rmDsummary *s)
{
	double acc = 0;

	struct field *f;
	for(f = &fields[WALL_TIME]; f->name != NULL; f++)
	{
		if(f->active)
		{
			acc += value_of_field(s, f);
		}
	}

	return acc;
}
Example #7
0
struct rmDsummary *rmsummary_to_rmDsummary(struct rmsummary *so) {

	struct rmDsummary *s = malloc(sizeof(struct rmDsummary));
	bzero(s, sizeof(*s));

	if(so->command) {
		s->command    = xxstrdup(so->command);
	}

	if(so->category)
	{
		s->category   = xxstrdup(so->category);
	}
	else if(so->command)
	{
		s->category   = parse_executable_name(so->command);
	}
	else
	{
		s->category   = xxstrdup(DEFAULT_CATEGORY);
		s->command    = xxstrdup(DEFAULT_CATEGORY);
	}

	if(so->task_id)
	{
		s->task_id = xxstrdup(so->task_id);
	}

	to_external(s, so, start);
	to_external(s, so, end);
	to_external(s, so, wall_time);
	to_external(s, so, cpu_time);

	to_external(s, so, cores);
	to_external(s, so, total_processes);
	to_external(s, so, max_concurrent_processes);

	to_external(s, so, memory);
	to_external(s, so, virtual_memory);
	to_external(s, so, swap_memory);

	to_external(s, so, bytes_read);
	to_external(s, so, bytes_written);

	to_external(s, so, bytes_received);
	to_external(s, so, bytes_sent);
	to_external(s, so, bandwidth);

	to_external(s, so, disk);
	to_external(s, so, total_files);

	struct field *f;
	for(f = &fields[WALL_TIME]; f->name != NULL; f++)
	{
		if(value_of_field(s, f) < 0)
		{
			assign_to_field(s, f, 0);
		}
	}

	return s;
}
Example #8
0
struct rmDsummary *parse_summary(FILE *stream, char *filename)
{
	static FILE *last_stream = NULL;
	static int   summ_id     = 1;

	if(last_stream != stream)
	{
		last_stream = stream;
		summ_id     = 1;
	}
	else
	{
		summ_id++;
	}

	struct rmsummary  *so = rmsummary_parse_next(stream);

	if(!so)
		return NULL;

	struct rmDsummary *s  = malloc(sizeof(struct rmDsummary));

	s->command    = so->command;

	s->file       = xxstrdup(filename);

	if(so->category)
	{
		s->category   = so->category;
	}
	else if(so->command)
	{
		s->category   = parse_executable_name(so->command);
	}
	else
	{
		s->category   = xxstrdup(DEFAULT_CATEGORY);
		s->command    = xxstrdup(DEFAULT_CATEGORY);
	}

	s->start     = usecs_to_secs(so->start);
	s->end       = usecs_to_secs(so->end);
	s->wall_time = usecs_to_secs(so->wall_time);
	s->cpu_time  = usecs_to_secs(so->cpu_time);

	s->cores = so->cores;
	s->total_processes = so->total_processes;
	s->max_concurrent_processes = so->max_concurrent_processes;

	s->virtual_memory = so->virtual_memory;
	s->resident_memory = so->resident_memory;
	s->swap_memory = so->swap_memory;

	s->bytes_read    = bytes_to_Mbytes(so->bytes_read);
	s->bytes_written = bytes_to_Mbytes(so->bytes_written);

	s->workdir_num_files = so->workdir_num_files;
	s->workdir_footprint = so->workdir_footprint;

	s->task_id = so->task_id;
	if(s->task_id < 0)
	{
		s->task_id = get_rule_number(filename);
	}

	struct field *f;
	for(f = &fields[WALL_TIME]; f->name != NULL; f++)
	{
		if(value_of_field(s, f) < 0)
		{
			assign_to_field(s, f, 0);
		}
	}

	free(so); //we do not free so->command on purpouse.

	return s;
}