Exemple #1
0
        private static void Main(string[] args)
        {
            GVFSPlatformLoader.Initialize();
            string enlistmentRootPath = @"M:\OS";

            if (args.Length > 0 && !string.IsNullOrWhiteSpace(args[0]))
            {
                enlistmentRootPath = args[0];
            }

            TestsToRun testsToRun = TestsToRun.All;

            if (args.Length > 1)
            {
                int tests;
                if (int.TryParse(args[1], out tests))
                {
                    testsToRun = (TestsToRun)tests;
                }
            }

            ProfilingEnvironment environment = new ProfilingEnvironment(enlistmentRootPath);

            Dictionary <TestsToRun, Action> allTests = new Dictionary <TestsToRun, Action>
            {
                { TestsToRun.ValidateIndex, () => GitIndexProjection.ReadIndex(environment.Context.Tracer, Path.Combine(environment.Enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Index)) },
                { TestsToRun.RebuildProjection, () => environment.FileSystemCallbacks.GitIndexProjectionProfiler.ForceRebuildProjection() },
                { TestsToRun.ValidateModifiedPaths, () => environment.FileSystemCallbacks.GitIndexProjectionProfiler.ForceAddMissingModifiedPaths(environment.Context.Tracer) },
            };

            long before = GetMemoryUsage();

            foreach (KeyValuePair <TestsToRun, Action> test in allTests)
            {
                if (IsOn(testsToRun, test.Key))
                {
                    TimeIt(test.Key.ToString(), test.Value);
                }
            }

            long after = GetMemoryUsage();

            Console.WriteLine($"Memory Usage: {FormatByteCount(after - before)}");
            Console.WriteLine();
            Console.WriteLine("Press Enter to exit");
            Console.Read();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            ProfilingEnvironment environment = new ProfilingEnvironment(@"M:\OS");

            TimeIt(
                "Validate Index",
                () => GitIndexProjection.ReadIndex(Path.Combine(environment.Enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Index)));
            TimeIt(
                "Index Parse (new projection)",
                () => environment.GVFltCallbacks.GitIndexProjectionProfiler.ForceRebuildProjection());
            TimeIt(
                "Index Parse (update offsets and validate)",
                () => environment.GVFltCallbacks.GitIndexProjectionProfiler.ForceUpdateOffsetsAndValidateSparseCheckout());
            TimeIt(
                "Index Parse (validate sparse checkout)",
                () => environment.GVFltCallbacks.GitIndexProjectionProfiler.ForceValidateSparseCheckout());
            Console.WriteLine("Press Enter to exit");
        }