Reverse lookup and sum also

Hi,
I have log file name that shows the view name and some SQL statement time
stamp. I want to summarize the SQL time with view. Here is the simple example

Here the seqence is first it prints EventContext and all the SQL statement time and again EventContext. Want to summarize the time for each EventContext.

some junk rows

So output should be

Basically look for all "SQL Statement" time(after : and before word seconds) and add them until you do not get the word EventContext.

As per my understanding its complex. So thanks in advance if some one can help resolve the problem

 awk '/EventContext ABS/ {x=$0}/SQL Statement/{a[x]+=$(NF-1)}END{for (i in a) print i,"[ Took "a" ]"}' file
EventContext ABS Sales Order Screen Homepage View [ Took 0.006 ]
EventContext ABS Sales Order List View [ Took 0.005 ]

or if you want keep the output in order:

awk '/EventContext ABS/ {x+=1;a[x]=$0}/SQL Statement/{b[x]+=$(NF-1)}END{for (i=1;i<=x;i++) print a,"[ Took "b" ]"}' file

Or...

 
awk -F: '{$0 ~ /^Even/?sql=$0:gsub("seconds",x,$2);sum[sql]=sum[sql] + $2}END{
 for(i in sum) print i,"Took[ "sum" ]"
}' infile
awk '/^Event/{print (p?t FS "[ Took " s "]":X);s=0;p=1;t=$0;next}{s+=$(NF-1)}END{print t FS "[ Took " s "]" }' infile

Thank you, Thank you, Thank you, Thank you very much all of you to look into the problem and give me some suggestions.
All the solutions are going to be very useful. To simplify the problem I made sample test data above. Since my test file is bit more complicated then that I might have to edit a bit to get working. But the statement below works fine for me at this point.

awk '/EventContext/ {x+=1;a[x]=$0}/SQL Statement/{b[x]+=$(NF-1)}END{for (i=1;i<=x;i++) print a[i],"[ Took "b[i]" ]"}' /tmp/t1

Is there possible to add two more things to this problem

  1. Print the count of "SQL Statement Execute Time" for each 'EventContext"
  2. Print the largest "SQL Statement" time in there.
  3. At the End of Report print the count of "SQL Statement Execute Time"
  4. At the End of Report print the Larget "SQL Statement" time in there.

So in my above sample data it should look like
EventContext ABS Sales Order Screen Homepage View [TOTAL SQL: 1 Took 0.006 MAX time SQL :0.004 ]
EventContext ABS Sales Order List View [TOTAL SQL : 1 Took 0.005 MAX time SQL : 0.004 ]
Summary ; Total SQL : 2 Took 0.008 Max time SQL : 0.004

Thanks

Even if some one has solution for any of point 1,2,3,4 then will be great help.

Is there possible to add two more things to this problem

  1. Print the count of "SQL Statement Execute Time" for each 'EventContext"
  2. Print the largest "SQL Statement" time in there.
  3. At the End of Report print the count of "SQL Statement Execute Time"
  4. At the End of Report print the Larget "SQL Statement" time in there.

Sample data in the first post.