On 2010-11-17, huisky <[email protected]> wrote:
> I want to read this file and do the summarize how much total CPU time
> consumed for each user.
> Is Python able to do so or say easy to achieve this?, anybody can give
> me some hints, appricate very much!

The question is, is the information you want available in the data.

> Example log file.
> **************************************************************************************
> LSTC license server version 224 started at Sun Dec  6 18:56:48 2009
> using configuration file /usr/local/lstc/server_data
> xyz [email protected] LS-DYNA_971 NCPU=1 started Sun Dec  6
> 18:57:40
> [email protected] completed Sun Dec  6 19:42:55
> xyz [email protected] LS-DYNA_971 NCPU=2 started Sun Dec  6
> 20:17:02
> [email protected] completed Sun Dec  6 20:26:03
> xyz [email protected] LS-DYNA_971 NCPU=1 started Sun Dec  6
> 21:01:17
> [email protected] completed Sun Dec  6 21:01:28
> tanhoi [email protected] LS-DYNA_971 NCPU=1 started Mon
> Dec  7 09:31:00
> [email protected] presumed dead Mon Dec  7 10:36:48
> sabril [email protected] LS-DYNA_971 NCPU=2 started Mon
> Dec  7 13:14:47
> [email protected] completed Mon Dec  7 13:24:07
> sabril [email protected] LS-DYNA_971 NCPU=2 started Mon
> Dec  7 14:21:34
> sabril [email protected] LS-DYNA_971 NCPU=2 started Mon
> Dec  7 14:28:42
> [email protected] killed Mon Dec  7 14:31:48
> [email protected] killed Mon Dec  7 14:32:06

I see starts, completes, kills, and presumed deads.  The question is can
the starts be matched to the completes and kills either from the numbers
before @ or from a combination of the address and NCPU.  You will need to
figure out whether or not you want to count the presumed deads in your
calculations.

Assuming that the starts and stops can be corrilated, it is a simple matter
of finding the pairs and using the datetime module to find the difference
in time between them.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to