Example #1
0
        public bool LoadFile(string file)
        {
            using (new WaitCursor())
            {
                var option = new ArchiveOption
                {
                    FileName = file,
                    Mode     = ArchiveMode.Open,
                    Pipeline = ArchivePipeline.Internel
                };
                ArchiveFactory.Instance().Archive(ref option);

                using (option.InternelStream)
                {
                    if (System.IO.Path.GetExtension(file) == ".trace")
                    {
                        return(OpenTrace <FTraceGroup>(file));
                    }

                    if (System.IO.Path.GetExtension(file) == ".json")
                    {
                        return(OpenTrace <ChromeTracingGroup>(file));
                    }

                    using (option.InternelStream)
                    {
                        return(Open(file, option.InternelStream));
                    }
                }
            }
            return(false);
        }
Example #2
0
        public static SummaryPack Create(String path)
        {
            if (File.Exists(path))
            {
                var option = new ArchiveOption
                {
                    Mode     = ArchiveMode.Open,
                    Pipeline = ArchivePipeline.Internel
                };
                ArchiveFactory.Instance().Archive(ref option);

                using (option.InternelStream)
                {
                    DataResponse response = DataResponse.Create(option.InternelStream);
                    if (response != null)
                    {
                        if (response.ResponseType == DataResponse.Type.SummaryPack)
                        {
                            return(new SummaryPack(response));
                        }
                    }
                }
            }

            return(null);
        }
        public override void Export(Point point, ThreadScroll scroll)
        {
            EventNode  node  = null;
            EventFrame frame = null;
            int        level = FindNode(point, scroll, out frame, out node);

            if (EventNodeSelected != null)
            {
                ITick tick = scroll.PixelToTime(point.X);
                if (frame == null)
                {
                    frame = FindFrame(tick);
                }
                if (frame != null)
                {
                    EventNodeSelected(this, frame, node);
                }
                if (node != null)
                {
                    var option = new ArchiveOption
                    {
                        Mode    = ArchiveMode.Save,
                        Sources = new List <IArchiveSource>
                        {
                            new NodeArchiveSource(node)
                        },
                        ArchiveType = ArchiveSourceType.Node
                    };
                    ArchiveFactory.Instance().Archive(ref option);
                }
            }
        }
        private void ExportFrameTable(ICollectionView view)
        {
            var factory = ArchiveFactory.Instance();
            var option  = new ArchiveOption
            {
                Mode    = ArchiveMode.Save,
                Sources = new List <IArchiveSource>
                {
                    new ViewArchiveSource(view),
                },
                ArchiveType = ArchiveSourceType.View
            };

            factory.Archive(ref option);
        }
Example #5
0
        private void ExportTags(EventNode node, FrameCollection frames)
        {
            var option = new ArchiveOption
            {
                Mode    = ArchiveMode.Save,
                Sources = new List <IArchiveSource>
                {
                    new NodeArchiveSource(node),
                    new FrameArchiveSource(frames)
                },
                ArchiveType = ArchiveSourceType.Tag
            };

            ArchiveFactory.Instance().Archive(ref option);
        }
Example #6
0
        private void OnMenuItemClick_Export(object sender, RoutedEventArgs e)
        {
            FrameCollection frames = new FrameCollection();

            frames.Add(frameList.SelectedItem as Frame);
            var option = new ArchiveOption
            {
                Mode    = ArchiveMode.Save,
                Sources = new List <IArchiveSource>
                {
                    new FrameArchiveSource(frames)
                },
                ArchiveType = ArchiveSourceType.Frame
            };

            ArchiveFactory.Instance().Archive(ref option);
        }
Example #7
0
 public String Save()
 {
     lock (frames)
     {
         var option = new ArchiveOption
         {
             Mode    = ArchiveMode.Save,
             Sources = new List <IArchiveSource>
             {
                 new FrameArchiveSource(frames)
             },
             ArchiveType = ArchiveSourceType.Frame
         };
         ArchiveFactory.Instance().Archive(ref option);
         frames.UpdateName(option.FileName, true);
         return(option.FileName);
     }
 }
Example #8
0
        public TimeLine()
        {
            this.InitializeComponent();
            this.DataContext = frames;

            ArchiveFactory.Instance();
            ArchiveFactory.Instance().Initialize();

            statusToError.Add(TracerStatus.TRACER_ERROR_ACCESS_DENIED, new KeyValuePair <string, string>("ETW can't start: launch your Game/VisualStudio/UE4Editor as administrator to collect context switches", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
            statusToError.Add(TracerStatus.TRACER_ERROR_ALREADY_EXISTS, new KeyValuePair <string, string>("ETW session already started (Reboot should help)", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
            statusToError.Add(TracerStatus.TRACER_FAILED, new KeyValuePair <string, string>("ETW session failed (Run your Game or Visual Studio as Administrator to get ETW data)", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
            statusToError.Add(TracerStatus.TRACER_INVALID_PASSWORD, new KeyValuePair <string, string>("Tracing session failed: invalid root password. Run the game as a root or pass a valid password through Optick GUI", "https://github.com/bombomby/optick/wiki/Event-Tracing-for-Windows"));
            statusToError.Add(TracerStatus.TRACER_NOT_IMPLEMENTED, new KeyValuePair <string, string>("Tracing sessions are not supported yet on the selected platform! Stay tuned!", "https://github.com/bombomby/optick"));

            ProfilerClient.Get().ConnectionChanged += TimeLine_ConnectionChanged;

            socketThread = new Thread(RecieveMessage);
            socketThread.Start();

            Document.Instance().Frames = frames;
        }
Example #9
0
        private void MenuExportFunctions(object sender, RoutedEventArgs e)
        {
            if (e.Source is FrameworkElement)
            {
                FrameworkElement item = e.Source as FrameworkElement;

                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    if (item.DataContext is EventNode)
                    {
                        var option = new ArchiveOption
                        {
                            Mode    = ArchiveMode.Save,
                            Sources = new List <IArchiveSource>
                            {
                                new NodeArchiveSource(item.DataContext as EventNode)
                            },
                            ArchiveType = ArchiveSourceType.Node
                        };
                        ArchiveFactory.Instance().Archive(ref option);
                    }
                }));
            }
        }