How to summary one command's cpu usage?

I want to record one application's(like oracle etc...) CPU usage summary.
I can filter by "ps". But how to sum?

Thanks

On my box,

ps -e | grep oracle

Gives me output that looks like this (column numbers entered by me)

0123456789012345678901234567890
  8827 ?         0:00 oracle
  6849 ?         0:00 oracle
 25473 ?         0:12 oracle

So I guess you could do something like...

#!/usr/bin/perl

foreach (`ps -e | grep oracle | cut -c 17-21`) {
        # strip the colon
        s/://;
        $sum = $_ + $sum;
        }

        print $sum;

But I think it would be more important to look at "top" to see what oracle process is taking the most time if you are looking to tune.