Example #1
0
 protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
 {
     timeLine.Close();
     ProfilerClient.Get().Close();
     base.OnClosing(e);
 }
Example #2
0
        static void Main(string[] args)
        {
            var options = new Options();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            IPAddress ip = null;

            IPAddress.TryParse(options.IpAddress, out ip);

            ProfilerClient.Get().IpAddress = ip;
            ProfilerClient.Get().Port      = options.Port;

            // Receive thread
            Thread socketThread = new Thread(RecieveMessage);

            socketThread.Start();

            var connectionEstablished = false;

            do
            {
                System.Console.WriteLine("Trying to connect...");

                connectionEstablished = ProfilerClient.Get().CheckConnection(100);

                if (connectionEstablished)
                {
                    System.Console.WriteLine("Connected sucessfully.");
                }
                else
                {
                    System.Threading.Thread.Sleep(500);
                }
            }while (!connectionEstablished);

            // Begin profiling
            if (ProfilerClient.Get().SendMessage(new StartMessage()))
            {
                System.Console.WriteLine("Begin capturing...");
                while (true)
                {
                    // Wait until a packet was done
                    Thread.Sleep(1000);

                    // Lost connection -> exit
                    if (!ProfilerClient.Get().IsConnected)
                    {
                        break;
                    }

                    // Emulate a message dump
                    ProfilerClient.Get().SendMessage(new StopMessage());
                    ProfilerClient.Get().SendMessage(new StartMessage());
                }

                System.Console.WriteLine("Done capturing.");

                socketThread.Abort();
                socketThread = null;

                // Connection was closed, save the data
                FileStream stream = new FileStream(options.Output, FileMode.Create);
                frames.Serialize(stream);
            }

            // Close the connection
            ProfilerClient.Get().Close();
        }
Example #3
0
 private void ClearSamplingButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     ProfilerClient.Get().SendMessage(new TurnSamplingMessage(-1, false));
 }
Example #4
0
 private void StartButton_Unchecked(object sender, System.Windows.RoutedEventArgs e)
 {
     ProfilerClient.Get().SendMessage(new StopMessage());
 }
Example #5
0
 private void ClearHooksButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     ProfilerClient.Get().SendMessage(new SetupHookMessage(0, false));
 }