🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.optimizeit.net.general
1 messages
1 total messages Started by G. E. Sutton Wed, 30 Mar 2005 19:03
Running a console app in Profiler
#54
Author: G. E. Sutton
Date: Wed, 30 Mar 2005 19:03
61 lines
3265 bytes
I have a VB.Net console application which I compile into an EXE.  If I run
the EXE, it opens a console window and displays information as expected.  If
I launch it under the Profiler for CPU recording, no console opens, and once
the application terminates, the profiler stops running and purges all
recorded information (I checked off the open console option in the Profiler,
but it does not display application console messages).

(BTW, I have copiled a Windows form version which opens the form window when
launched within the Profiler so at least I know that much works.)

I have a couple of work arounds; if I pause the application within the
profiler before it is done, I can stop recording and view results.  If I
want the console application to finish processing before I pause it: 1) I
have to guess since I get no console display to tell me where it is in its
processing; 2) I have the console application save a dummy file to the file
system and then sleep for a minute so I can notice the creation of the file
and pause the application before it terminates and purges my recording
session.

There must be a better way of working with console applications from within
the profiler (I have not tried executing from a command line).

Also, is there any documentation regarding the integration with Visual
Studio 2003?  I get an OptimizeIt menu option that lets me open a
configuration form, but how do I control the Profiler from within VS2003?
Using the Profiler and the VS debugger together seems like it would be very
useful, but how is it done?

FWIW here is the console app source code:

Imports System.Threading.Thread
Imports System.IO

Module Module1

    Sub Main()

        Console.WriteLine("Process starting")

        Try
            'Do some meaningful work here
        Catch ex As Exception
            Console.WriteLine("The following error occured: " & ex.Message)
        End Try

        Console.WriteLine("Process complete")
        'Normally I could stop here but...


        'Write out a file so I can tell when the process is done.
        Dim myWriter As New StreamWriter("C:\myTest.txt")
        myWriter.WriteLine("Process complete")
        myWriter.Close()

        'Wait a minute before terminating so I can pause execution
        'in the Profiler and stop recording
        Sleep(60000)

    End Sub

End Module
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads