1.

Solve : Batch process to record load times of applications/programs etc?

Answer»

In the past I have written some batch log scripts that I rename the actual EXE of a program to be monitored, I then create a simple batch that starts the program under its different file name identity and records when the program was run appended to a log, and this batch file I would compile to a EXE with a BAT to EXE compiler so that the OS continued to run as if nothing ever happened with same paths etc. Such as the following, and in this example I will use notepad.exe

Batch File is compiled with Bat 2 EXE as Notepad.exe and placed into C:\windows\system32\ with the following instruction
Quote

echo. Notepad Run on %date% at %time%>>c:\systemlog\notepad.log
START c:\windows\system32\notepad1.exe

I used this mainly to get statistical info on how often and when specific programs were being launched by users when I use to work in IT at a prior job.

Question I have now is that I want to record how long it takes for an application to get from its start to run condition to its fully loaded state.

Sure you could take a stop watch with you and test between clicking on a program and when you visually see that the program is fully up and ready for input to then stop the stop watch, but I am checking in here to see if there is a method to do this with batch or vbscript or combination etc.

I KNOW that with tasklist I could have it test for when a windowtitle becomes active, however that would not show the actual completion time in which the program loaded, it would just show the INSTANCE in which tasklist detected it as a valid window title name.

Maybe this cant be done because looking at it from a programming standpoint, the easiest method would be to have the program such as notepad1.exe which is being started have a routine at the end that states that its fully loaded in which the program to run itself responds back, however this is not a valid method for programs that are compiled and illegal to decompile to add features like a response back 

If this cant be done in a batch file maybe a screen parser might work to look for a trigger characteristic on the users display in which only when the program is fully loaded would it trigger a positive for such as File to be displayed in the top left corner of a window for notepad etc.

The biggest problem with going the complex route to parse and OCR a screen is that its going to use a lot of processing power to parse, test the capture, and refresh the results until a positive hit is detected. There is info here on how to do it with screen captures, but a live display to constantly monitor for a trigger and then log would just cripple a system I feel. http://stackoverflow.com/questions/2986486/parse-text-from-a-screen-grab

My assumption is that I would need to basically still go with the same method as I have done in the past with renaming the actual EXE and creating a batch file as that same EXE's name that calls to the alternate named EXE in which the start time is easy to record and append to a file, but from there on to test for when the program is fully loaded I am at a loss as to how to pull it off without pulling too many resources that would skew the data. 

Its my understanding that

Quote
echo. Notepad Started on %date% at %time%>>c:\systemlog\notepad.log
START c:\windows\system32\notepad1.exe
echo. Notepad Loaded Fully on %date% at %time%>>c:\systemlog\notepad.log

Is not a valid way to measure loadtime of applications because the START instruction starts the program and once the program is started the batch moves on to the next instruction vs waiting for the program to be in its completely full open state of operation for user input. Otherwise this would be easy.  Not sure if this will suit your needs...

See Here...Thanks Patio

This site you linked had this info:
Quote
FYI - I don't think timeit works on Windows 7 64-bit. You get the error "Unable to query system performance data (c0000004). Instead, use PowerShell's "Measure-Command" like Casey.K suggests:

I guess I will be checking into powershell's Measure-Command since the OS would be a non-server OS such as XP, Vista, 7, 8, 8.1, or 10Yeah...there's a few other hand authored solutions there as well....Hope it helps.Just read down to this interesting batch there that you call the batch file followed by the application to launch and it records how long the application was active for. Going to save this batch for someday when I need to keep track of application use lengths. I could have used this way back when we were looking at use frequency as a better measurement of what programs are used and for how long even if just running idle.


Code: [Select]echo off
setlocal

set start=%time%

:: runs your command
cmd /c %*

set end=%time%
set options="tokens=1-4 delims=:."
for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100
for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100

set /a hours=%end_h%-%start_h%
set /a mins=%end_m%-%start_m%
set /a secs=%end_s%-%start_s%
set /a ms=%end_ms%-%start_ms%
if %hours% lss 0 set /a hours = 24%hours%
if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins%
if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs%
if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms%
if 1%ms% lss 100 set ms=0%ms%

:: mission accomplished
set /a totalsecs = %hours%*3600 + %mins%*60 + %secs%
echo command took %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total)
For a program that runs and at completion closes on its own this would work perfect for if you dont have access to the source code to just add a logger to the program internally. Very Cool. I think I am going to play with powershell and see where that leads.

If the only option this way is to find when the programs ended vs got to a ready to run state, then maybe I could pull off a CPU monitoring trick some how. Where say you know the CPU is idle at 3% with nothing else going on, and you launch the program to start and the CPU is going to use greater than 3%, and sense when the CPU drops back to an idle value with the application running, so say the program loads and the cpu bounces between 40 and 100% and finally comes to rest at 6%. You could have a process run that doesnt eat up too much processing power itself to then trigger when CPU goes equal to or less than 6%. However this  would require so much fine tuning that it would probably be easier to have a person stop watch it. And every system that would run this would have to be custom tweaked for trigger point of CPU activity back to idle with application running
Couldn't you just include a basic app task in the batch which would tell you when it get's to the usable point and time that ? ?
What you are trying to do is likely impossible. And I tend to avoid using that word. But it is impossible in the sense that it is effectively a variant of a computer problem that nobody has ever found a solution to, the halting problem.

Furthermore, It's not even as well-defined. The halting problem is effectively the problem if creating a program/algorithm to determine if another program will halt (hang), without hanging itself. What it means for an application to be "Ready" is going to be application-specific, and the method of determining it is in that state is going to be equally specific.

As you mentioned, could just check and wait for the application to become idle (use less than, say, 10% of CPU for some time frame, such as 5 seconds) but that will probably trigger for splash screens (Which sometimes incorporate a full on sleep for a few seconds to make sure the splash screen actually displays), and if you set the delay longer to compensate, you'll detect the program is "ready" sometime after it actually becomes ready. The actual CPU Utilization might be hardware dependent as well. Even while starting Word doesn't seem to use more than 3% for me, for example.

The taskbar icon is useless as you noted. You also cannot test to see if the Application's Main Window has started to respond, because Splash screens will count as the Main Window. OCR doesn't make it any easier because you still won't necessarily know what you are looking for. And if you use "OCR" than you'll have to adjust based on the selected theme and if the system is using some sort of skin or different colour palette, not to mention dealing with System DPI settings.


Also, re your 'auditing' tool that records programs that were launched- One limitation is that you need to create "alternate" executables for every program you want to watch. However it would probably be useful to know when people run unauthorized software somehow, not to mention nice to not have to deploy a bunch of new copied files when you change software around, so being able to record any executable would be nice. It would be possible to write a service that intercepts Windows WMI Events and detect when applications launch and exit. I do that for my company's Updater program for the purpose of "watching" which of our programs launch and terminate, but ended up abandoning the idea mainly because the updater would not be running very often or long enough for that information to be very useful. (And the original idea of showing different icons in the updater for running and not running programs seemed excessive) I expect it would be possible to use from VBScript, as WMI is sort of intended for VBScript. Effectively WMI allows you to create queries and one feature allows you to receive an event notification when the results of a query change. I was going to paste the code here but C# probably wouldn't be very useful.


Thanks BC for the well in depth info on this matter. As well as in regards to:

Quote
Effectively WMI allows you to create queries and one feature allows you to receive an event notification when the results of a query change. I was going to paste the code here but C# probably wouldn't be very useful.

This sounds very interesting. So you could run a query save the info temporarily, and then run a query again and compare for changes, and then when differences are detected report on the differences essentially.

Also I dabble in C# so if you want to share C# here, please feel free to do so as for I would probably learn from your code example etc.

Quote
What you are trying to do is likely impossible. And I tend to avoid using that word. But it is impossible in the sense that it is effectively a variant of a computer problem that nobody has ever found a solution to, the halting problem.

I was thinking it might be impossible, however I had to share here to see if there was a method that goes beyond my technical means of carrying this out. I think the biggest problem is that a system monitoring itself is going to offset factual information of how long it really takes to get a program from launch to halt condition in which its ready for user input.

As far as the CPU monitoring method for idle after launch of a program you mentioned it would trigger splash screens. What do you mean by this? Is this related to parsing the screen looking for CPU usage vs using another method for detecting CPU utilization status? After I walked away from the computer before when I posted and suggested a method might be to detect CPU usage, I realized in deeper thought that there might be a race condition with this, that the program itself that is looking for an idle state might not be able to ever detect an idle state as it happens as for the minute the program triggers even if after a sleep condition its going to use the CPU and cause a spike of activity until it goes back into its rest/sleep state, so it might never actually detect less than 10% etc. However if a service was created that read in the CPU for say 2 seconds and then stopped monitoring when called by the other program which creates a spike of CPU activity, it wouldnt be reading the live data direct from CPU that it itself created a spike to affect itself, but instead it would get the average for 2 seconds from the service. But that again assumes that the service isnt CPU intensive.

I guess I will leave this with the understanding that others have been where I intended to go and there is no good solution for this.

If there was a solution it could have been coded in any script or programming language to pull it off, didnt need to be specifically in batch, however the most lightweight processing could be achieved through batch and thats why I decided to post this here even though it might really be geared towards the programming or other section.

Thanks for all input on this. 



I'm officially outta my league on this one...sorry... Quote from: DaveLembke on July 25, 2015, 12:28:38 PM

This sounds very interesting. So you could run a query save the info temporarily, and then run a query again and compare for changes, and then when differences are detected report on the differences essentially.
I'm not sure how it works inside of WMI. You merely register for the event- it will notify when something changes. I had it set to watch SELECT * FROM Win32_ProcessStartTrace and SELECT * FROM Win32_ProcessStopTrace which would detect when a program starts and closes respectively. I think internally WMI is actually polling.

Quote
Also I dabble in C# so if you want to share C# here, please feel free to do so as for I would probably learn from your code example etc.
I tried to separate it into a "sample" type program but it doesn't seem to work properly, or it may not work on Windows 8 or something (I know it works though since the debug logs from customers definitely have the info!) It also looks like it may take up to 5 seconds to actually get the notification, so it probably wouldn't work (beyond actual logging that programs launch/exit). At any rate, here it is. Really it's just a class that get's used elsewhere:

Code: [Select]using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;

namespace ProcessWatcher
{
   
        public class ProcessEventArgs : EventArgs
        {
            public ProcessEventArgs(Process pProcess)
            {
                ForProcess = pProcess;
            }

            public Process ForProcess { get; private set; }
        }

        public class ProcessLaunchEventArgs : ProcessEventArgs
        {
            public ProcessLaunchEventArgs(Process pProcess)
                : base(pProcess)
            {
            }
        }

        public class ProcessExitEventArgs : ProcessEventArgs
        {
            public ProcessExitEventArgs(Process pProcess)
                : base(pProcess)
            {
            }
        }
        /// <summary>
        /// I got the idea for the Updater to display which programs were already running. The main issue was that
        /// it would have needed polling. Thankfully, there are WMI classes that can be used to actually receive event notifications
        /// for launched applications. From that we can create a Process object (or at least defer creation) and then
        /// handle the Exited() event to detect when a process exits.
        /// This class basically wraps both to allow for hooking of two static events which will be fired automatically.
        ///
        /// </summary>
        public class ProcessEvents
        {
            private static ManagementEventWatcher startWatch;
            private static ManagementEventWatcher stopWatch;

            static ProcessEvents()
            {
                //this will work in Win XP, but not Vista or 7 or 8 if the process is not elevated.
                //it will work on XP as-is, and as long as we ignore the error we should be fine.
                //Arguably we could take a really weird Polling approach, but that would be less than pleasant.
                try
                {
                    startWatch = new ManagementEventWatcher
                        (
                        new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace"));
                    startWatch.EventArrived += startWatch_EventArrived;
                    startWatch.Start();
                    stopWatch = new ManagementEventWatcher
                        (
                        new WqlEventQuery("SELECT * FROM Win32_ProcessStopTrace"));
                    stopWatch.EventArrived += stopWatch_EventArrived;
                    stopWatch.Start();
                }
                catch (Exception exx)
                {
                    Debug.Print("Exception trying to start WMI Process Watcher:" + exx);
                }
            }

            public static event EventHandler<ProcessLaunchEventArgs> LaunchEvent;
            public static event EventHandler<ProcessExitEventArgs> ExitEvent;

            private static void InvokeLaunch(ProcessLaunchEventArgs ev)
            {
                var copied = LaunchEvent;
                if (copied != null)
                {
                    copied(null, ev);
                }
            }
            private static void InvokeExit(ProcessExitEventArgs ev)
            {
                var copied = ExitEvent;
                if (copied != null)
                {
                    copied(null, ev);
                }
            }

            public static void Cleanup()
            {
                if (startWatch != null) startWatch.Stop();
                if (stopWatch != null) stopWatch.Stop();
            }
            private static void stopWatch_EventArrived(object sender, EventArrivedEventArgs e)
            {
                try
                {
                    int ProcessID = int.Parse(e.NewEvent.Properties["ProcessID"].Value.ToString());
                    Process ForProcess = null;
                    try
                    {
                        ForProcess = Process.GetProcessById(ProcessID);
                    }
                    catch (Exception)
                    {
                        ForProcess=null;
                    }
                    InvokeLaunch(new ProcessLaunchEventArgs(ForProcess));
                    Debug.Print("Process stopped: {0}", e.NewEvent.Properties["ProcessName"].Value);
                }
                catch (Exception)
                {
                }
            }
            private static void startWatch_EventArrived(object sender, EventArrivedEventArgs e)
            {
                try
                {
                    int ProcessID = int.Parse(e.NewEvent.Properties["ProcessID"].Value.ToString());
                    InvokeExit(new ProcessExitEventArgs(Process.GetProcessById(ProcessID)));
                    Debug.Print("Process started: {0}", e.NewEvent.Properties["ProcessName"].Value);
                }
                catch (Exception)
                {
                }
            }
        }
    }


Then it would be used by hooking the events, something like this:

Code: [Select]using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ProcessWatcher
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {

            ProcessEvents.LaunchEvent += ProcessEvents_LaunchEvent;
            ProcessEvents.ExitEvent += ProcessEvents_ExitEvent;
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new frmProcessWatcher());
        }

        static void ProcessEvents_ExitEvent(object sender, ProcessExitEventArgs e)
        {
            Console.WriteLine(e.ForProcess.ProcessName + " Exited.");
        }

        static void ProcessEvents_LaunchEvent(object sender, ProcessLaunchEventArgs e)
        {
            Console.WriteLine(e.ForProcess.ProcessName + " Launched.");
        }
    }
}

Quote
As far as the CPU monitoring method for idle after launch of a program you mentioned it would trigger splash screens. What do you mean by this? Is this related to parsing the screen looking for CPU usage vs using another method for detecting CPU utilization status?

Each process has process utilization that can be inspected- I'm referring to the Process's CPU utilization, not the CPU utilization in general. If we try to detect when the program has finished loading based on when it's utilization drops off, it will think it is done when a splash screen is shown, because most splash screens include a purposeful "sleep" where they do nothing and don't use any processor time.

Adding to what I mentioned, I discovered the inconsistency. it appears i was mistaken, it still works on Windows 8.1 the same way as on XP/Vista/7. However, it seems like it only works properly with very high level privileges, in this case it seems the logs I am seeing that show a trace of programs that launched is coming from the scheduled updates which run via the task scheduler under the ServiceProfile account, but running it manually doesn't trigger the events.

I suppose that makes sense. It does have a lot of caveats and by this point it's become something of a tangent.

Anyway, my thought regarding that was that assuming it all WORKED you'd be abl to "profile" any program that started.

For example you'd handle an event when notepad.exe is launched. You'd record that the program launched, then spin off another thread to keep an eye on that process as it starts up. in C# Processes are represented with the Process object which maps pretty much directly to the Process Handle information that is part of the Win32 API. In my mind it would be done like so

Code: [Select]//This dictionary would be a member-level variable
private Dictionary<Process,Thread> ProcessAttendants = new Dictionary<Process,Thread>();

// This would be in the start event handler... spin off a new thread to watch this process. EventProcess would be the Process that was given as part of the event arguments.
Thread Attendant = new Thread(AttendantHandler);
ProcessAttendants.Add(EventProcess,Attendant);
Attendant.Start(EventProcess);

And then you would have the AttendantHandler be a routine that basically sits and 'watches' a process:

Code: [Select]private void AttendantHandler(Object ProcessItem)
{
    Process AttendProcess = ProcessItem as Process;
    while(!AttendProcess.Exited)
    {
        Thread.Sleep(50);
        //Determine if process has "started" completely here, somehow
    }

}

Also, looking closer, getting Processor % for a process isn't directly part of the Process, but is retrieved with a Performance COUNTER. It might be possible to test the TotalProcessorTime each iteration and "trigger" that it has finished after the Delta drops to some specific value.Thanks for SHARING the C# source on this and explaining it all, and clarifying the prior info. Hopefully this info shared is beneficial to other future site visitors as it has been for myself. 

Was looking at C# methods to get CPU info and found a feature in Windows that I wasnt aware of typeperf as seen here. The interesting thing is that Google pooled this in with a C# search maybe because of the CS of the site name  http://www.csarchive.net/2013/06/view-cpu-usage-using-typeperf.html

Here is what it showed for system that I tested it on:


Code: [Select]C:\test123>typeperf  "\Processor(_Total)\% Processor Time"

"(PDH-CSV 4.0)","\\ATHLON4450B\Processor(_Total)\% Processor Time"
"07/25/2015 23:40:15.797","21.376747"
"07/25/2015 23:40:16.798","22.077423"
"07/25/2015 23:40:17.799","18.181289"
"07/25/2015 23:40:18.800","11.168262"
"07/25/2015 23:40:19.801","24.415105"
"07/25/2015 23:40:20.802","15.927605"
"07/25/2015 23:40:21.804","19.819840"
"07/25/2015 23:40:22.807","11.256916"
"07/25/2015 23:40:23.808","25.973556"
"07/25/2015 23:40:24.810","24.490529"
"07/25/2015 23:40:25.811","16.622847"
"07/25/2015 23:40:26.812","11.947483"
"07/25/2015 23:40:27.813","16.622847"
"07/25/2015 23:40:28.817","17.648875"
"07/25/2015 23:40:29.824","19.443376"
"07/25/2015 23:40:30.825","23.635874"
"07/25/2015 23:40:31.829","24.640946"
"07/25/2015 23:40:32.831","19.041397"
"07/25/2015 23:40:33.832","41.616397"
"07/25/2015 23:40:34.834","66.493287"
"07/25/2015 23:40:35.847","77.670148"
"07/25/2015 23:40:36.848","74.285544"
"07/25/2015 23:40:37.852","72.808596"
"07/25/2015 23:40:38.853","75.089661"
"07/25/2015 23:40:39.855","69.610190"
"07/25/2015 23:40:40.856","54.025684"
"07/25/2015 23:40:41.857","25.194326"
"07/25/2015 23:40:42.858","18.181289"
"07/25/2015 23:40:43.859","11.947493"
"07/25/2015 23:40:44.860","17.402068"
"07/25/2015 23:40:45.861","15.064386"
"07/25/2015 23:40:46.862","22.856653"
"07/25/2015 23:40:47.863","13.505934"
"07/25/2015 23:40:48.864","17.402068"


Note:
  In order to use typeperf, you must either be a member of the local
  Performance Log Users group, or the command must be executed from an
  elevated command window.

C:\test123>
Here is additional info on typeperf usage:


Code: [Select]Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.


C:\test123>typeperf/?

Microsoft r TypePerf.exe (6.1.7601.18869)

Typeperf writes performance data to the command window or to a log file. To
stop Typeperf, press CTRL+C.

Usage:
typeperf { <counter [counter ...]> | -cf <filename> | -q [object]
                                | -qx [object] } [options]

Parameters:
  <counter [counter ...]>       Performance counters to monitor.

Options:
  -?                            Displays context sensitive help.
  -f <CSV|TSV|BIN|SQL>          Output file format. Default is CSV.
  -cf <filename>                File containing performance counters to
                                monitor, one per line.
  -si <[[hh:]mm:]ss>            Time between samples. Default is 1 second.
  -o <filename>                 Path of output file or SQL database. Default
                                is STDOUT.
  -q [object]                   List installed counters (no instances). To
                                list counters for one object, include the
                                object name, such as Processor.
  -qx [object]                  List installed counters with instances. To
                                list counters for one object, include the
                                object name, such as Processor.
  -sc <samples>                 Number of samples to collect. Default is to
                                sample until CTRL+C.
  -config <filename>            Settings file containing command options.
  -s <computer_name>            Server to monitor if no server is specified
                                in the counter path.
  -y                            Answer yes to all questions without prompting.

Note:
  Counter is the full name of a performance counter in
  "\\<Computer>\<Object>(<Instance>)\<Counter>" format,
  such as "\\Server1\Processor(0)\% User Time".

Examples:
  typeperf "\Processor(_Total)\% Processor Time"
  typeperf -cf counters.txt -si 5 -sc 50 -f TSV -o domain2.tsv
  typeperf -qx PhysicalDisk -o counters.txt

C:\test123

Tested this out on my Windows XP system in addition to this Windows 7 system that I am on to see if it goes back that far... sure enough its there so typeperf works on XP and 7 and likely Vista as well.

Quote from: patio on July 25, 2015, 01:12:34 PM
I'm officially outta my league on this one...sorry...

I'm on the sidelines too.Interesting find on the Typeperf. I was able to have it display the processor usage of a specific process. In this case, I chose my text editor. While it was sampling I grabbed the window and moved it around a bit:

Code: [Select]C:\Windows\system32>typeperf "\Process(EditPadPro7)\% Processor Time"

"(PDH-CSV 4.0)","\\PETATRON\Process(EditPadPro7)\% Processor Time"
"07/26/2015 04:14:52.908","0.000000"
"07/26/2015 04:14:53.910","0.000000"
"07/26/2015 04:14:54.912","0.000000"
"07/26/2015 04:14:55.916","6.234487"
"07/26/2015 04:14:56.920","12.450440"
"07/26/2015 04:14:57.924","28.014915"
"07/26/2015 04:14:58.927","24.926027"
"07/26/2015 04:14:59.928","3.117450"
"07/26/2015 04:15:00.931","0.000000"

The command completed successfully.

One could imagine that you could use the -sc 1 parameter to only get a single sample, which gives us:

Code: [Select]
"(PDH-CSV 4.0)","\\PETATRON\Process(EditPadPro7)\% Processor Time"
"07/26/2015 04:17:42.395","0.000000"

The command completed successfully.

Which I'm sure could be parsed via the command prompt to grab the actual % and used for logging or what-have-you.
Code: [Select]"(PDH-CSV 4.0)","\\PETATRON\Process(EditPadPro7)\% Processor Time"
"07/26/2015 04:17:42.395","0.000000"

The command completed successfully.

Quote
Which I'm sure could be parsed via the command prompt to grab the actual % and used for logging or what-have-you.

Yes this was my thought exactly, being able to take the output and parse it. I ended up running out of time last night to check into its ability for measurement of a specific process. Thanks for sharing your results on this. I tried to do this with notepad last night and got an error message and it was late, so I just posted what I had to share and crashed for the evening. Very cool that it worked.

Looking back at what I attempted, I now realize what I did wrong when awake at the 18th hour of the day. I ran
typeperf -cf notepad.exe "\Processor(_Total)\% Processor Time"   but the -cf is not to be used for the file to monitor, its use " Specifies a file containing a list of performance counters to monitor, with one counter per line. "

Another cool fact from finding this is that typeperf's output could be used with a batch process to parse the data that is redirected to a file as well and report back with info.

So such as with your data here:

Quote
"07/26/2015 04:14:52.908","0.000000"
"07/26/2015 04:14:53.910","0.000000"
"07/26/2015 04:14:54.912","0.000000"
"07/26/2015 04:14:55.916","6.234487"
"07/26/2015 04:14:56.920","12.450440"
"07/26/2015 04:14:57.924","28.014915"
"07/26/2015 04:14:58.927","24.926027"
"07/26/2015 04:14:59.928","3.117450"
"07/26/2015 04:15:00.931","0.000000"

You could parse it to get data after the comma delimiter on each line, and clean it up to remove the " " so that the output could be read in as a value to a script

Quote
0.000000
0.000000
0.000000
6.234487
12.450440
28.014915
24.926027
3.117450
0.000000

Then the script looks for greater than 0.0000 as a starting point for the application/program, and a point in which it comes back to rest at 0.0000 and the data within is essentially the load time data. Using this in conjunction back with the original data that has the time stamp of each sample, you then could get

Program started on = 07/26/2015 04:14:55.916
Program idle at        = 07/26/2015 04:15:00.931


And you can then go further and have it perform the load time math and report back with

07/26/2015 Total Load time for this application = 00:00:04.985


This is assuming that the last sample of "07/26/2015 04:15:00.931","0.000000" was with the EditPadPro7 at rest in its halt state and that this measurement wasnt taken after this application was closed.

There might be an even better method of extracting and creating the final output, but this is what I thought up on the fly after reading your post back to this. 



Discussion

No Comment Found