# comments 
<mode>render</mode>
1,2,3

<mode>image</mode>
title=>Cumulative Distribution of Delays from min to 500 ms 
legend=>CDF,Total
xlabel=>Delay in milliseconds
ylabel=>Probe Count
rmode=>lines-pt
data=>1,2,3

<mode>ascii</mode>
col_names=>Milli Second Delays,Cumulative Probe Count,Total Probe Count
col_numbers=>1,2,3

<mode>resolution</mode>
60,3600,86400

<mode> query  </mode>
WITH
NodePair(id) as 
(
SELECT np.id as id 
FROM {schema_name}nodepairs np
WHERE np.srcnodeid = {srcid} AND np.destnodeid = {destid}  
), 
ProbesPerDelay(Delay, NumProbes) as 
( 
SELECT (t.Delay/1000 + 1) as Delay, count(*) as NumProbes 
FROM {schema_name}times t, NodePair n 
WHERE 	t.Delay != -1 AND t.start BETWEEN ( {start_time} ) AND ( {end_time} ) AND 
	t.nodepairid = n.id AND (t.Delay/1000+1) <= 500 
GROUP BY (t.Delay/1000+1)
), 
TotalProbes (Probes) as 
( 
SELECT count_big(*) 
FROM {schema_name}Times t, NodePair n  
WHERE t.NodePairID = n.id AND t.start BETWEEN ( {start_time} ) AND ( {end_time} ) 
)
SELECT 	pd.Delay as "mSec Delay", 
	sum(tmp.NumProbes) as "Cumulative", 
	tp.Probes as "Total" 
FROM ProbesPerDelay pd, TotalProbes tp, ProbesPerDelay tmp 
WHERE tmp.Delay <= pd.Delay 
GROUP BY pd.Delay, tp.Probes 
ORDER BY pd.Delay
<mode>endquery</mode>
