public ReporterWindow(InputData data, ReportKind reportKind)
		{
			InitializeComponent();
			_inputData = data;
			_currentRepot = CurrentDataReport.OutputDataReport;
			_reportKind = reportKind;
		}
Exemplo n.º 2
0
        public ReportKindViewModel(ReportKind reportKind)
        {
            if (reportKind == null)
            {
                throw new ArgumentException("reportKind");
            }

            Name        = reportKind.Name;
            Description = reportKind.Description;
            IsSelected  = reportKind.IsSelected;
        }
Exemplo n.º 3
0
		public ReporterCreator(DataBase data, ReportKind reportKind)
		{
			_reportKind = reportKind;
			Document = new FlowDocument { ColumnWidth = 15000 };
			var mainTable = new Table
			{
				FontFamily = new FontFamily("Arial")
			};
			BaseRows(data, ref mainTable);
			Document.Blocks.Add(mainTable);
		}
Exemplo n.º 4
0
        public FilterReportIpViewModel(ReportKind model, IReportFilter baseFilterReportViewModel)
        {
            Model                   = model;
            NameSystemTable         = "Выбор источника";
            FilterIntervalViewModel = baseFilterReportViewModel;

            ShapesCodeReport = new ObservableCollection <ShapeReportViewModel>
            {
                new ShapeReportViewModel(ShapeCodeReport.TableChart),
            };
            CurrentShape = ShapesCodeReport.FirstOrDefault();
        }
        public FilterReportIntervalViewModel(ReportKind model)
        {
            Model = model;

            //var dtNow = DateTime.Now;
            //_dateTimeFrom = new DateTime(dtNow.Year, dtNow.Month, 1);
            //_dateTimeTo = dtNow;

            var dtNow = DateTime.Now;

            _dateTimeFrom = new DateTime(2017, 10, 1);
            _dateTimeTo   = new DateTime(2017, 10, 31);
        }
Exemplo n.º 6
0
        public FilterReportNotifyViewModel(ReportKind model, IReportFilter baseFilterReportViewModel)
        {
            Model                   = model;
            Name                    = model.Name;
            NameSystemTable         = "Выбор уведомления";
            FilterIntervalViewModel = baseFilterReportViewModel;

            ShapesCodeReport = new ObservableCollection <ShapeReportViewModel>
            {
                new ShapeReportViewModel(ShapeCodeReport.ColumnChart),
                new ShapeReportViewModel(ShapeCodeReport.PieChart),
                new ShapeReportViewModel(ShapeCodeReport.LineChart),
            };
            CurrentShape = ShapesCodeReport.FirstOrDefault();
        }
Exemplo n.º 7
0
        private string[] GetExportFormatNames(ReportKind reportKind)
        {
            switch (reportKind)
            {
            case ReportKind.C1dDocument:
            case ReportKind.ImportedReport:
                return(GetExportFormatNames(c_dummyC1PrintDocument));

            case ReportKind.XmlReport:
                return(GetExportFormatNames(c_dummyC1Report));

            case ReportKind.Program:
                return(c_exportFormatsNa);

            default:
                return(null);
            }
        }
Exemplo n.º 8
0
		public static InputData DrawInputData(Grid grid, ReportKind kind)
		{
			var inputData = new InputData();
			var rowCount = grid.RowDefinitions.Count;

			foreach (var metaData in inputData.Data)
			{
				if (metaData.Value.Report == kind)
				{
					grid.RowDefinitions.Add(new RowDefinition());

					var inputDataBlock = new TextBlock { Text = metaData.Value.Title, FontSize = 16, VerticalAlignment = VerticalAlignment.Center };
					grid.Children.Add(inputDataBlock);
					Grid.SetRow(inputDataBlock, rowCount);
					Grid.SetColumn(inputDataBlock, 0);

					var inputDataBox = new TextBox { Text = metaData.Value.Val.ToString(CultureInfo.InstalledUICulture), FontSize = 16, Width = 200, Height = 25, Name = metaData.Key, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 3, 0, 2) };
					inputDataBox.TextChanged += DoubleOnly;
					inputDataBox.GotKeyboardFocus += InputDataBox_GotKeyboardFocus;
					grid.Children.Add(inputDataBox);
					Grid.SetRow(inputDataBox, rowCount);
					Grid.SetColumn(inputDataBox, 1);

					if (metaData.Value.Symbol != null)
					{
						var symbol = new Symbol(metaData.Value.Symbol.MainSymbol, metaData.Value.Symbol.SubSymbol, metaData.Value.Symbol.SuperSymbol)
						{
							VerticalAlignment = VerticalAlignment.Center
						};
						grid.Children.Add(symbol);
						Grid.SetRow(symbol, rowCount);
						Grid.SetColumn(symbol, 2);
					}
					rowCount++;
				}
			}
			return inputData;
		}
Exemplo n.º 9
0
		public MetaData(double v, List<EngineType> engine, string t = "", Symbol symbol = null, int group = -1, ImageSource formula = null, ReportKind report = ReportKind.Thermal, Range? range = null)
			:base()
		{
			Val = v;
			Title = t;
			Symbol = symbol;
			Group = group;
			ValRange = range;
			Formula = formula;
			Report = report;
			if (engine == null)
			{
				Engine = new List<EngineType>
				{
					EngineType.Petrol,
					EngineType.Diesel,
					EngineType.SuperDiesel
				};
			}
			else
			{
				Engine = engine;
			}
		}
Exemplo n.º 10
0
 public static Report New(ReportKind kind)
 {
     return new Report()
     {
         Id = Guid.NewGuid(),
         Kind = kind
     };
 }
Exemplo n.º 11
0
        public MainForm(string[] arguments)
        {
            int i;
            string logFileName = "";
            bool onlyCreateLog = false;
            processFileName = null;
            windowsStoreAppProfileeInfo = null;

            profileAllocations = profileCalls = profilingActive = true;

            //Check ProfilerOBJ.DLL exist first
            if (!File.Exists( getProfilerFullPath() ) )
            {
                ShowErrorMessage("Can not find '" + getProfilerFullPath() + "', please make sure ProfilerOBJ.dll exists at the same directory as CLRProfiler.exe.");
                Environment.ExitCode = 1;
                exitProgram = true;
                return;
            }

            #region arguments
            if (arguments.Length > 0)
            {
                int pid;

                Environment.ExitCode = 0;

                switch (arguments[0])
                {
                    case "-attach":
                    case "/attach":
                        exitProgram = true;
                        if ((pid = getPID(arguments)) == 0)
                        {
                            Environment.ExitCode = 1;
                            return;
                        }

                        for (int index = 2; index + 1 < arguments.Length; index = index+2)
                        { 
                            if (arguments[index] == "-o" || arguments[index] == "/o")
                            {
                                string fullPath = Path.GetFullPath(arguments[index+1]);
                                logDirectory = Path.GetDirectoryName(fullPath);
                                nameToUse = Path.GetFileName(fullPath);
                            }

                            if (arguments[index] == "-t" || arguments[index] == "/t")
                            {
                                maxWaitingTimeInMiliseconds = UInt32.Parse(arguments[index + 1]);
                                if (maxWaitingTimeInMiliseconds < 3000)
                                {
                                    maxWaitingTimeInMiliseconds = 3000;
                                    ShowErrorMessage("CLRProfiler must wait a minimum of 3000 milliseconds before it will time out while attaching to the application.");
                                }
                            }
                        }

                        if(logDirectory == null)
                        {
                            logDirectory = Directory.GetCurrentDirectory();
                        }
                        /* basic initialization stuff */
                        CreatePipe(@"\\.\pipe\OMV_PIPE", false, ref handshakingPipeHandle, ref handshakingPipe);
                        CreatePipe(@"\\.\pipe\OMV_LOGGING_PIPE", false, ref loggingPipeHandle, ref loggingPipe);
                        instance = this;

                        if (attachProfiler(pid, GetLogFullPath(pid)) )
                        {
                            Console.WriteLine("The logging data is saved at " + GetLogFullPath(pid) + ".");
                        }
                        else
                        {
                            Environment.ExitCode = 1;
                        }

                        ClearProfiledProcessInfo();
                        return;

                    case "-detach":
                    case "/detach":
                        exitProgram = true;

                        if ((pid = getPID(arguments)) == 0)
                        {
                            Environment.ExitCode = 1;
                            return;
                        }

                        if (!InitWindowsStoreAppProfileeInfoIfNecessary(pid))
                            return;

                        if (!isProfilerLoaded(pid))
                        {
                            Console.WriteLine("PID argument is not valid.");
                            Environment.ExitCode = 1;
                            return;
                        }

                        CreateEvents(pid);

                        SendDetachRequest();

                        Console.WriteLine("Detach is sucessfully requested.");
                        Console.WriteLine("It may take a while for CLRProfiler to be unloaded completely.  ");
                        Console.WriteLine("You may look for profiler detach event from the event log to determine if detach succeeds.");

                        ClearProfiledProcessInfo();
                        return;

                    case "-dumpheap":
                    case "/dumpheap":
                        exitProgram = true;

                        if ((pid = getPID(arguments)) == 0)
                        {
                            Environment.ExitCode = 1;
                            return;
                        }

                        if (!InitWindowsStoreAppProfileeInfoIfNecessary(pid))
                            return;

                        if (!isProfilerLoaded(pid))
                        {
                            Console.WriteLine("PID argument is not valid.");
                            Environment.ExitCode = 1;
                            return;
                        }

                        CreateEvents(pid);
                        forceGcCompletedEvent.Wait(1);
                        forceGcCompletedEvent.Reset();
                        forceGcEvent.Set();
                        Console.WriteLine(Path.GetFileName(Application.ExecutablePath) + " is waiting up to 10 minutes for target process to finish dumping the GC heap.");
                        if (forceGcCompletedEvent.Wait(10 * 60 * 1000))
                        {
                            forceGcCompletedEvent.Reset();
                            Console.WriteLine("A heap dump is appended in the log file.");
                        }
                        else
                        {
                            Console.WriteLine("There was no response from the target process.");
                            Environment.ExitCode = 1;
                        }
                        ClearEvents();
                        ClearProfiledProcessInfo();
                        return;
                }
            }
            #endregion arguments
            #region arguments2
            for (i = 0; i < arguments.Length && !onlyCreateLog; i++)
            {
                switch (arguments[i])
                {
                    case "-target":
                    case "/target":
                        string version = FetchArgument(arguments, ref i);

                        if (String.Compare(version, "V4DesktopCLR", true) == 0)
                            targetCLRVersion = CLRSKU.V4DesktopCLR;
                        else if (String.Compare(version, "V4CoreCLR", true) == 0)
                            targetCLRVersion = CLRSKU.V4CoreCLR;
                        else if (String.Compare(version, "V2DesktopCLR", true) == 0)
                            targetCLRVersion = CLRSKU.V2DesktopCLR;
                        else
                        {
                            CommandLineError("No matched target CLR version.");
                            help = true;
                        }
                        break;

                    case "-u":
                    case "/u":
                        if (logFileName == null)
                        {
                            CommandLineError("A log filename needs to be specified with -o beofre -u argument");
                            help = true;
                        }
                        else
                        {
                            profilingURL = FetchArgument(arguments, ref i);
                            if (profilingURL != null)
                                onlyCreateLog = true;
                        }
                        break;

                    case "-na":
                    case "/na":
                        profileAllocations = false;
                        break;

                    case "-nc":
                    case "/nc":
                        profileCalls = false;
                        break;

                    case "-np":
                    case "/np":
                        profilingActive = false;
                        break;

                    case "/ns":
                    case "-ns":
                        trackCallStacks = false;
                        break;

                    case "-o":
                    case "/o":
                        logFileName = FetchArgument(arguments, ref i);
                        break;

                    case "-p":
                    case "/p":
                        processFileName = FetchArgument(arguments, ref i);
                        if (processFileName != null)
                            onlyCreateLog = true;
                        break;

                    case "-diff":
                    case "/diff":
                        graphtype = Graph.GraphType.AllocationGraph;
                        break;

                    case "-lo":
                    case "/lo":
                        prevlogFileName = FetchArgument(arguments, ref i);
                        break;

                    case "-ln":
                    case "/ln":
                        currlogFileName = FetchArgument(arguments, ref i);
                        break;

                    case "-ld":
                    case "/ld":
                        difflogFileName = FetchArgument(arguments, ref i);
                        break;

                    case "-l":
                    case "/l":
                        logFileName = FetchArgument(arguments, ref i);
                        break;

                    case "-a":
                    case "/a":
                        reportKind = ReportKind.AllocationReport;
                        break;

                    case "-r":
                    case "/r":
                        reportKind = ReportKind.RelocationReport;
                        break;

                    case "-s":
                    case "/s":
                        reportKind = ReportKind.SurvivorReport;
                        break;

                    case "-sd":
                    case "/sd":
                        reportKind = ReportKind.SurvivorDifferenceReport;
                        break;

                    case "-h":
                    case "/h":
                        reportKind = ReportKind.HeapDumpReport;
                        break;

                    case "-lr":
                    case "/lr":
                        reportKind = ReportKind.LeakReport;
                        break;

                    case "-f":
                    case "/f":
                        reportKind = ReportKind.FinalizerReport;
                        break;

                    case "-cf":
                    case "/cf":
                        reportKind = ReportKind.CriticalFinalizerReport;
                        break;

                    case "-c":
                    case "/c":
                        reportKind = ReportKind.CommentReport;
                        break;

                    case "-b":
                    case "/b":
                        startMarker = FetchArgument(arguments, ref i);
                        break;

                    case "-e":
                    case "/e":
                        endMarker = FetchArgument(arguments, ref i);
                        break;

                    case "-t":
                    case "/t":
                        do
                        {
                            string[] newTimeMarker = new String[timeMarker.Length + 1];
                            for (int j = 0; j < timeMarker.Length; j++)
                                newTimeMarker[j] = timeMarker[j];
                            newTimeMarker[timeMarker.Length] = FetchArgument(arguments, ref i);
                            timeMarker = newTimeMarker;
                        }
                        while (i + 1 < arguments.Length && arguments[i + 1][0] != '-' && arguments[i + 1][0] != '/');
                        break;

                    case "-w":
                    case "/w":
                        this.noUI = false;
                        break;

                    case "-?":
                    case "/?":
                    case "-help":
                    case "/help":
                        help = true;
                        break;

                    case "-gc":
                    case "/gc":
                        gcOnLogFileComments = true;
                        break;

                    default:
                        if (arguments[i][0] == '-' || arguments[i][0] == '/')
                            CommandLineError("Unrecognized option {0}", arguments[i]);
                        else if (File.Exists(arguments[i]))
                            logFileName = arguments[i];
                        else
                            CommandLineError("Log file {0} not found", arguments[i]);
                        break;
                }
            }
            #endregion arguments2
            #region AllocationGraph
            if (graphtype == Graph.GraphType.AllocationGraph)
            {
                if (File.Exists(prevlogFileName) && File.Exists(currlogFileName))
                {
                    viewdiff = true;
                    return;
                }
                else
                {
                    String s = "";
                    if (!File.Exists(prevlogFileName))
                    {
                        s += String.Format("Previous build log File not exists or command line missing -lo. \n");
                    }
                    if (!File.Exists(currlogFileName))
                    {
                        s += String.Format("New build log file not exists or command line missing -ln \n");
                    }
                    CommandLineError(s);
                }
            }
            #endregion AllocationGraph
            #region NoReport
            else if (reportKind != ReportKind.NoReport)
            {
                if (logFileName == "")
                    CommandLineError("Need -l logFileName for report");
                else if (!File.Exists(logFileName))
                    CommandLineError("Log file {0} not found", logFileName);
                else
                {
                    switch (reportKind)
                    {
                        case ReportKind.AllocationReport:
                            Reports.AllocationReport(logFileName, startMarker, endMarker);
                            break;

                        case ReportKind.RelocationReport:
                            Reports.RelocationReport(logFileName, startMarker, endMarker);
                            break;

                        case ReportKind.SurvivorReport:
                            Reports.SurvivorReport(logFileName, startMarker, endMarker, timeMarker);
                            break;

                        case ReportKind.SurvivorDifferenceReport:
                            Reports.SurvivorDifferenceReport(logFileName, startMarker, endMarker);
                            break;

                        case ReportKind.HeapDumpReport:
                            Reports.HeapDumpReport(logFileName, startMarker, endMarker);
                            break;

                        case ReportKind.LeakReport:
                            Reports.LeakReport(logFileName, startMarker, endMarker);
                            break;

                        case ReportKind.FinalizerReport:
                            Reports.FinalizerReport(false, logFileName, startMarker, endMarker);
                            break;

                        case ReportKind.CriticalFinalizerReport:
                            Reports.FinalizerReport(true, logFileName, startMarker, endMarker);
                            break;

                        case ReportKind.CommentReport:
                            Reports.CommentReport(logFileName);
                            break;
                    }
                }
            }
            #endregion NoReport
            else
            {
                if (onlyCreateLog)
                {
                    /* treat everything after the exe name to profile as arguments */
                    for (; i < arguments.Length; i++)
                    {
                        commandLine += arguments[i] + ' ';
                    }
                }
                /* basic initialization stuff */
                CreatePipe(@"\\.\pipe\OMV_PIPE", false, ref handshakingPipeHandle, ref handshakingPipe);
                CreatePipe(@"\\.\pipe\OMV_LOGGING_PIPE", false, ref loggingPipeHandle, ref loggingPipe);
                instance = this;

                if (!onlyCreateLog)
                {
                    /* standard UI operation */
                    if (help)
                    {
                        ShowUsage();
                        exitProgram = true;
                        return;
                    }
                    noUI = false;
                    //
                    // Required for Windows Form Designer support
                    //
                    InitializeComponent();

                    // Set V4 Desktop CLR to be the default value
                    targetCLRVersioncomboBox.SelectedIndex = 0;

                    font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))); ;

                    if (logFileName != "" && File.Exists(logFileName))
                        LoadLogFile(logFileName);

                    EnableDisableViewMenuItems();
                }
                else
                {
                    /* command-line only */
                    noUI = true;
                    exitProgram = true;

                    try
                    {
                        string fileName = (logFileName == "" ? Path.ChangeExtension(processFileName, ".log") : logFileName);
                        string fullPath = Path.GetFullPath(fileName);
                        logDirectory = Path.GetDirectoryName(fullPath);
                        nameToUse = Path.GetFileName(fileName);

                        if (profilingURL == null)
                        {
                            startApplicationButton_Click(null, null);
                        }
                        else
                        {
                            startURLButton_Click(null, null);
                        }

                        if (profilerConnected)
                        {
                            Environment.ExitCode = 0;
                        }
                        else
                        {
                            Environment.ExitCode = 1;
                        }

                        while (profiledProcess != null && !ProfiledProcessHasExited())
                            Thread.Sleep(500);
                    }
                    catch (Exception e)
                    {
                        throw new Exception(e.Message + '\n' + e.StackTrace);
                        // Console.WriteLine("There was a problem profiling {0}", processFileName);
                    }
                }
            }
        }
Exemplo n.º 12
0
		private void Next_OnClick(object sender, RoutedEventArgs e)
		{
			if (_currentReportKind == ReportKind.Thermal)
			{
				if (MainFrame.CanGoForward)
					MainFrame.GoForward();
				else
					MainFrame.Navigate(_dynamicPage);
				_currentReportKind = ReportKind.Dynamic;
				Next.Content = "<< Тепловий розрахунок";
				Title = "Engine Calculator - Динамічний розрахунок";
				var inputData = new InputData();
				NewInputData(_thermalPage.InputDataGrid, ref inputData);
				_dynamicPage.DrawEspeciallyOutputData(new OutputData(inputData, false));
				BuildGraph.Visibility = Visibility.Visible;
			}
			else
			{
				if (MainFrame.CanGoBack)
					MainFrame.GoBack();
				else
					MainFrame.Navigate(_thermalPage);
				_currentReportKind = ReportKind.Thermal;
				Next.Content = "Динамічний розрахунок >>";
				Title = "Engine Calculator - Тепловий розрахунок";
				BuildGraph.Visibility = Visibility.Hidden;
			}
		}