Map themap {
	"Busy" 1, "Idle" 0 }

ArrayGraph lifelines (p, 0, NO_OF_PROCESSORS - 1) {
	name <- "Processor Lifelines",
	menu <- "Lifelines",
	usemap <- themap,
	y_axis <- "Processor",
	action {
		EV_BUSY: INC(p),
		EV_IDLE: DEC(p)
	}
}

ArrayMetricsTable "profile calls" {
	name <- "Procedure Calls",
	menu <- "Calls",
	x_axis <- "Number of Calls",
	y_axis <- "Procedure",
	profile
}

ArrayMetricsTable "profile time" {
	name <- "Procedure Times",
	menu <- "Procedure Times",
	x_axis <- "Total Time",
	y_axis <- "Procedure",
	profile
}

BarGraph bar (x, 0, metric("profile calls") - 1) {
	name <- "Average Cycles Per Call",
	menu <- "Cycles/Call",
	x_axis <- "Cycles/Call",
	value(metric("profile time", x) / metric("profile calls", x)),
	profile
}

EventGraph blocked_threads {
      name <- "Number of Threads Waiting on Output Semaphore",
      menu <- "Blocked Threads",
      x_axis <- "Time",
      y_axis <- "Blocked Threads",
      action {
            EV_SEM_P: INC,
            EV_SEM_V: DEC
      }
}

EventGraph concurrency {
	name <- "Concurrency Graph",
	menu <- "Concurrency",
	x_axis <- "Time",
	y_axis <- "Busy Processors",
	action {
		EV_BUSY: INC,
		EV_IDLE: DEC
	}
}

EventGraph threads {
	name <- "Active Threads versus Time",
	menu <- "Active Threads",
	x_axis <- "Time",
	y_axis <- "Active Threads",
	action {
		EV_START_THREAD: INC,
		EV_END_THREAD: DEC
	}
}


ArrayGraph sem (p, 0, MAX_SEMAPHORES - 1) {
	name <- "Threads Blocked on Semaphores",
	menu <- "Semaphores",
	y_axis <- "Semaphore",
	action {
		EV_SEM_P:INC(p),
		EV_SEM_V:DEC(p)
	}
}

ArrayGraph cache (x, 0, NO_OF_PROCESSORS -1) {
	menu <- "Cache Ratio",
	name <- "Cache Hit Ratio versus Time",
	y_axis <- "Processor",
	action {
		EV_CACHE: VALUE(x)
	},
	dividers { 25, 50, 60, 70,
		   75, 80, 82, 84,
		   86, 88, 90, 92,
	 	   94, 96, 98 }
}


ArrayGraph netcontention (x, 0, NO_OF_PROCESSORS -1) {
	menu <- "Net Contention",
	name <- "Net Delay per 100 packets due to contention",
	y_axis <- "Processor",
	action {
		EV_NETCONT: VALUE(x)
	},
	dividers { 1, 2, 5, 10, 15, 20, 25, 30, 35, 45, 55, 65, 75, 85, 95}
}



MultiGraph multi (threads, concurrency, blocked_threads) {
	name <- "Concurrency",
	menu <- "Multi",
	y_axis <- "Number"
}


MetricsTable {
	name <- "Metrics Summary",
	x_axis <- "Value",
	y_axis <- "Metric",
	menu <- "Metrics"
}
