next up previous
Next: Miscellaneous Up: Changes to functions Previous: Recording Time

Aggregating on Compression

Aggregating on intranode compression takes place whenever two nodes have matched and are being merged into a single node. All that was required for this was to identify the correct places to add the following code to. Aggregation involved, computing the new min value, the new max value and computing the new average using the number of nodes aggregated by each rsd node.

	void compress_rsd(rsd_queue *queue, replay_op *operation, int push)
	{
		...
		if(merge_iter->data.time[MIN_TIME] > target_iter->data.time[MIN_TIME])
		    merge_iter->data.time[MIN_TIME] = target_iter->data.time[MIN_TIME];
		// Set the maximum time value for the merged node
		if(merge_iter->data.time[MAX_TIME] < target_iter->data.time[MAX_TIME])
		    merge_iter->data.time[MAX_TIME] = target_iter->data.time[MAX_TIME];
		// Sanity check for numAggregated
		if(merge_iter->numAggregated <= 0 || target_iter->numAggregated <= 0)
		{
		    printf("Number of nodes aggregated into a single node cannot be 
			less than one:merge %d, target %d", merge_iter->numAggregated, 
			target_iter->numAggregated);
		    exit(1);
		}
		// Compute and set the average time value for the merged node.
		// Compute the new value for the number of nodes aggregated into this one
		
		merge_iter->data.time[AVG_TIME] = 
		(merge_iter->data.time[AVG_TIME]*merge_iter->numAggregated) + 
		(target_iter->data.time[AVG_TIME]*target_iter->numAggregated);
		
		merge_iter->numAggregated += target_iter->numAggregated;
		merge_iter->data.time[AVG_TIME] /= merge_iter->numAggregated;
		...
	}

Aggregation on Internode compression was similar. There was an internode compression call in transfer.c called merge_queues. Identical code additions were made to this function in the relevant places.


Blazing Demon 2006-11-30