Advertisement

02.25.2008 at 09:33AM PST, ID: 23190877
[x]
Attachment Details

Perl script to parse a file and write to a new file containing the average CPL for a call.

Asked by agitar in Perl Programming Language

<sampleResult timeStamp="1203020590037" dataType="text" threadName="Alex Thread 1-1" label="1 GET /ndm-core/en.us/examples/sample_MultiSlot_PerItm.jsp" time="31" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020590225" dataType="text" threadName="Alex Thread 1-1" label="2 GET /ndm-core/sessionstart" time="0" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020590287" dataType="text" threadName="Alex Thread 1-1" label="3 GET /ndm-core/logdata" time="0" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020605443" dataType="text" threadName="Alex Thread 1-1" label="4 GET /ndm-core/customcontext" time="156" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020605506" dataType="text" threadName="Alex Thread 1-1" label="5 POST /ndm-core/log" time="0" responseMessage="Internal Server Error" responseCode="500" success="false"/>

<sampleResult timeStamp="1203020605521" dataType="text" threadName="Alex Thread 1-1" label="6 GET /ndm-core/sessionend" time="0" responseMessage="Internal Server Error" responseCode="500" success="false"/>

<sampleResult timeStamp="1203020605646" dataType="text" threadName="Alex Thread 1-1" label="1 GET /ndm-core/en.us/examples/sample_MultiSlot_PerItm.jsp" time="0" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020605787" dataType="text" threadName="Alex Thread 1-1" label="2 GET /ndm-core/sessionstart" time="0" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020605834" dataType="text" threadName="Alex Thread 1-1" label="3 GET /ndm-core/logdata" time="0" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020620881" dataType="text" threadName="Alex Thread 1-1" label="4 GET /ndm-core/customcontext" time="31" responseMessage="OK" responseCode="200" success="true"/>

<sampleResult timeStamp="1203020620943" dataType="text" threadName="Alex Thread 1-1" label="5 POST /ndm-core/log" time="0" responseMessage="Internal Server Error" responseCode="500" success="false"/>

<sampleResult timeStamp="1203020620959" dataType="text" threadName="Alex Thread 1-1" label="6 GET /ndm-core/sessionend" time="16" responseMessage="Internal Server Error" responseCode="500" success="false"/>

------------------------------------------------------------------------------------------------------------------------
So From this xml ,Basically we need the output in another file to be as follows:-
Call 1,ThreadName:name of thread,Average response time:avg response time
Call 2,ThreadName:name of thread,Average response time:avg response time
 
So in this case, a call would be the first 6 responses,
The second call would be the next 6 responses&

A log file could have anywhere from 1 to 10 different threads and each different thread could have a different number of requests (represented by label)


So what were going to need to do is parse out the time for each request and then calculated the avg response time for each call.

To determine a call, we will need to basically load everything into arrays and then check the label value& when the next value starts at 1 again, then we are at a new call.

Start Free Trial
Attachments:
 
The file from where we have to take data
 
 
Keywords: Perl script to parse a file and write to a…
 
Loading Advertisement...
 
[+][-]02.25.2008 at 09:37AM PST, ID: 20977416

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2008 at 10:40AM PST, ID: 20978019

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.26.2008 at 07:12AM PST, ID: 20984968

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.26.2008 at 08:48AM PST, ID: 20986056

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]02.27.2008 at 07:25AM PST, ID: 20994728

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.27.2008 at 07:31AM PST, ID: 20994786

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.27.2008 at 07:40AM PST, ID: 20994855

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.27.2008 at 08:26AM PST, ID: 20995340

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Sign Up Now!
Solution Provided By: Adam314
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.28.2008 at 03:55AM PST, ID: 21002815

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628