Giter VIP home page Giter VIP logo

compilescore's People

Contributors

bitowl avatar centrekepler avatar galop1n avatar honkstar1 avatar jorgenpt avatar kjeong0 avatar plundgren-code avatar trass3r avatar viladoman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compilescore's Issues

Unreal Engine Improvements

Hey there, I'm impressed with how well this works with Unreal out of the box! That being said there's a few parts that could be improved.

  1. Running "Build and Profile" on just the game project causes a full rebuild of the entire engine. I suspect this is due to Unreal being 'smart' about which toolchains it's using. We're using AutoSDK and I'm guessing CompileScore only uses the built in toolchain. Not sure if there's any easy answers to this one.
  2. Need to manually disable "Unity" (Fat/Amalgamation/Combined) builds. Currently CompileScore isn't terribly useful just because the results are not accurate due to the unity builds. If CompileScore did this automatically somehow it would definitely cause a full recompile every time. Also not really sure if there's an easy answer to this.

I think Unreal can output various forms of compilation databases, which may be interesting to replay the exact same commands with the exact same compilers Unreal is using.

I think some documentation on these (or other best practices on using CompileScore with Unreal) would probably satisfy me. Worst case at least having a ticket open with some of these gotcha's is hopefully enough for anyone else wanting to try this out 👍

Thanks for making this!

No results when profiling a build using the MSVC 2015 toolchain

What's the minimum MSVC toolchain this works with? I started data collection, ran a build which uses the compiler and linker from MSVC 2015, stopped data collection, and ended up with a 1K .scor file which when loaded seems to contain no data.

Does this have a minimum compiler version e.g. 2019 toolchains?

Getting "[ERROR] input path is not a directory"

On "Build Solution and Profile" using an elevated instance of VS: Score Data Extractor failed to start the recording session with code -1. The current build data won't be captured. Please check the output pane for more information.

Output from Compile Score:

[18:44:53] Calling ScoreDataExtractor with -clang -start -i C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/
[ERROR] input path is not a directory.
Execution Time: 01ms
[18:44:53] [ERROR] Score Data Extractor failed to start the recording session with code -1. The current build data won't be captured. Please check the output pane for more information.
[18:44:56] Building...
[18:45:16] Calling ScoreDataExtractor with -clang -stop -tp 100 -td 3 -d 3 -i C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/ -o "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/Compile Score/compileData.scor"
[ERROR] input path is not a directory.
Execution Time: 00ms
[18:45:16] [ERROR] Score Data Extractor process failed with code -1. Please check the output pane for more information.
[18:45:22] Score generation completed!
[18:45:22] Score file main processed in 79 μs
[18:45:22] Score file globals processed in 61 μs

Output from Build:

Rebuild started...
1>------ Rebuild All started: Project: Prime Bitstrings, Configuration: Release x64 ------
1>Prime Bitstrings.vcxproj -> C:\Users\Jim Viebke\Dropbox\Code\C++\Prime Bitstrings\x64\Release\Prime Bitstrings.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild started at 6:44 PM and took 23.600 seconds ==========

Settings:

{
  "ScoreSource": 1,
  "ScoreLocation": "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/Compile Score/compileData.scor",
  "ScoreGenerator": {
    "Compiler": 1,
    "InputPath": "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/",
    "OutputPath": "C:/Users/Jim Viebke/Dropbox/Code/C++/Prime Bitstrings/Compile Score/compileData.scor",
    "OverviewDetail": 3,
    "TimelineDetail": 3,
    "TimelinePacking": 100,
    "ExtractIncluders": true,
    "CollapseTemplateArgs": true
  }
}

Using:
Visual Studio Community 2022, 17.7.6
Compile Score 1.8.4, Data Version 9
Clang 16.0.5
Windows 10

Crash during extraction with MSVC

This may be related to #10

I get a crash when stopping recording with MSVC, I debugged it and it crashes here: https://github.com/Viladoman/CompileScore/blob/master/DataExtractor/src/Extractors/MSVCScore.cpp#L45

Because both compilerPass.OutputObjectPath() and compilerPass.InputSourcePath() are nullptr. I am not well-versed enough in all this to tell you why! I can get the program to complete execution by returning "[unknown]" if those are nullptr but then most units end up not having a name.

We are generating a VS2019 solution with CMake with MSVC as compiler. Let me know if I can provide more info!

ScoreDataExtractor crashes when stopping

Here is what I do:

  • start command prompt as administrator (btw, same behaviour when using non-elevated mode)
  • start ScoreDataExtractor
C:\Users\bw\AppData\Local\Temp\ScoreExtractor>ScoreDataExtractor.exe -msvc -start
Starting MSVC recording...
Recording session started successfully!
Execution Time: 08ms
  • build some C++ projects in Visual Studio 2019
  • stop ScoreDataExtractor
C:\Users\bw\AppData\Local\Temp\ScoreExtractor>ScoreDataExtractor.exe -msvc -stop -o %temp%\TF_Qt.scor
Stopping MSVC recording and Generating Score...

then Application crashes

Faulting application name: ScoreDataExtractor.exe, version: 0.0.0.0, time stamp: 0x600116b4
Faulting module name: ScoreDataExtractor.exe, version: 0.0.0.0, time stamp: 0x600116b4
Exception code: 0xc0000005
Fault offset: 0x000000000000b5a3
Faulting process id: 0xf28
Faulting application start time: 0x01d6f09e4e1e6d2f
Faulting application path: C:\Users\bw\AppData\Local\Temp\ScoreExtractor\ScoreDataExtractor.exe
Faulting module path: C:\Users\bw\AppData\Local\Temp\ScoreExtractor\ScoreDataExtractor.exe
Report Id: fa6ddbe0-99c7-4837-9f42-6b58d9b2fe3c
Faulting package full name: 
Faulting package-relative application ID: 

I am using

Microsoft Visual Studio Professional 2019
Version 16.7.2
VisualStudio.16.Release/16.7.2+30413.136
Microsoft .NET Framework
Version 4.8.03752

Not a lot of information, I am afraid. Please tell me if there is anything more specific I can provide.

Thanks in advance, Benjamin

Problems with multiple header files with same name

In the image below, working down from the top, it's correct up to registry.h. However, my project has two files with that name (this is hard to avoid when using lots of third party libs). The chain of files shown to be includers of registry.h (those below it in the image) are in fact includers of the other file, not the one that includes compilednodedefinition.h.

image

Not sure if this is a bug/oversight in CompileScore, or a limitation of the compilers? I also don't know at this point if this bug extends to the timings, or if it's just in the include graph. You would probably know right away whether or not they're backed by the same data.

Thanks for a great tool btw.

Feature: exclusive time counts

One thing that becomes clear quite quickly when analysing using CompileScore is the dependency on #include order, and how that has to be taken into account when interpreting results. By this I'm referring to the fact that a single header can have wildly different times in different contexts, due to the effect of include guards and what other headers have been included before it in one context vs another.

It seems like having an 'exclusive time' column for each header would be very useful for making it easier to identify the true compilation time offenders. So basically, the time that was spent compiling the header, minus the time spent within all its #includes. I'm not sure if the underlying compiler invocations can give you this information directly, but even if not it seems like you probably have the data you need to calculate it. Is this something you've considered?

Problems with getting data into VS extension

So I think there are perhaps a couple of different issues. I loaded up the test project (built as-is with Clang 10) one further time, and without having changed anything this time it correctly displayed the data (I'd previously rebuilt the project and restarted VS a couple of times without any luck, despite the parsing reporting success). So I guess maybe there's just some unpredictability relating to VS extension initialization order? If it was possible to enable more logging it might help pin down things like that.

As for my own project, built using a source-built pre-Clang 11, I'm still seeing the source files displayed but with no numbers. Attaching an example json file from the Clang output - I can see one additional field that didn't show up in the test project output, but it doesn't look like that would be an issue. Otherwise the format appears the same, but I may be missing something.
no_data
api_alloc.cpp.json.zip

[ERROR] Unknown output file extension provided

Hi,
I get the following error every time I run the profiler

[14:19:17] Calling ScoreDataExtractor with -msvc -start -d 1 -td 1
Starting MSVC recording...
Recording session started successfully!
Execution Time: 06ms
[14:19:17] Building...
[14:19:29] Calling ScoreDataExtractor with -msvc -stop -tp 100 -td 1 -d 1 -o C:\Git\Pathtracer\compileData.scor
[ERROR] Unknown output file extension provided. The MSVC generator only knows how to generate .scor or .etl files.
Execution Time: 00ms
[14:19:29] [ERROR] Score Data Extractor process failed with code 1. Please check the output pane for more information.
[14:20:45] Score generation completed!

I also get the error A recording is currently in progress on your system is preventing CompileScore from starting a new one.This can occur if you forgot to stop a CompileScore recording prior to running the start command, or if other processes have started ETW traces of their own.Please try running the CompileScore -stop command. every time I dont manually stop the profiler with tracelog -stop MSVC_BUILD_INSIGHTS_SESSION_COMPILE_SCORE

Quality of life: powershell script for automation (already implemented)

TLDR

Powershell script for automating captures https://gist.github.com/ikrima/45497f8d664c35f0d656b95773426ac3

Not sure if this is useful enough to be in the repo. If so, lmk, I can make a PR, update the defaults, and strip references to CppBuildAnalyzer

Details

I got tired of starting/stopping and made a powershell script that auto-elevates. Also I always forget the steps after a week and end up hunting them down

The gist auto elevates but is annoying that the UAC prompt will come up each time.
My local version uses gsudo which caches elevation requests for 5 mins but the repo version probably shouldn't use it bc security
The two lines are just commented out in the gist

Running it is simple:

.\vcperf.ps1 -start
[build in visual studio]
.\vcperf.ps1 -stop -compilescore

Clash of colour highlighting with git diffs

It's a minor issue, but the colouring of #includes leads to confusion when using Visual Studio's built-in git diff features. At a glance, it looks like all includes are source code changes.

I wonder if the context (diff vs regular view) is exposed by VS so that the extension can optionally disable the annotations? Failing that, just a simpler way to toggle the annotation functionality (a toolbar button or keyboard shortcut) would be useful.

minor bug: VS extension not properly parsing include headers

Not new bug, at least since I first started using the extension. Just finally hit it enough to cross my threshold for reporting :P

I looked into it initially and iirc, the issue was with < & > not escaped when serialized to some buffer (maybe the compile.scor file?) but it's been a months

The problematic headers are things like #include <windows>

Stack trace:

System.ArgumentException: Illegal characters in path.&#x000D;&#x000A;   
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)&#x000D;&#x000A;
at System.IO.Path.GetFileName(String path)&#x000D;&#x000A;
at CompileScore.ScoreGlyphTagger.CreateTrackingSpans()&#x000D;&#x000A;
at CompileScore.ScoreGlyphTagger..ctor(ITextView view, ITextBuffer sourceBuffer)&#x000D;&#x000A;
at CompileScore.ScoreGlyphTaggerProvider.CreateTagger[T](ITextView textView, ITextBuffer buffer)&#x000D;&#x000A;
at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.InstantiateViewTagger(ITextView textView, Lazy`2 factory, ITextBuffer textBuffer, IList`1 newTaggers)&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Extension crashes after changing a solution configuration

I'm using VS2022. Extension version: 1.8.4. When I'm opening a solution extension crashes with error in ActivityLog:

SetSite failed for package [CompileScorePackage]Source: 'Microsoft.VisualStudio.Text.Data' Description: Specified argument was out of the range of valid values. Parameter name: length System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: length at Microsoft.VisualStudio.Text.Span..ctor(Int32 start, Int32 length) at CompileScore.ScoreGlyphTagger.RefreshTags() at CompileScore.Notify.Invoke() at CompileScore.CompilerData.TryNotifyDataChanged() at CompileScore.CompilerData.OnSolutionSettingsChanged() at CompileScore.CompilerData.OnEditorModeChanged() at CompileScore.Notify.Invoke() at CompileScore.EditorContext.SetMode(EditorMode input) at CompileScore.EditorContext.CheckAlreadyOpenedContext() at CompileScore.CompileScorePackage.<InitializeAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass21_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)

At first, I thought that I was due to deleting a platform but crash acts very strangely and now I have no idea why can it be. I'm creating a new empty solution - it works. But when I'm starting to add file or change number of configurations/platforms, it can start crashing.

Average time in Compile Score Timeline

It would be nice to have a option to show the Compile Score Timeline with the average time, if you have a lot of modules with different pch that would be really helpful.

UX improvements

Tried the standalone app on a big project. Very nice tool!
A few small things I noticed:

  • By default the horizontal space isn't fully used. I always have to manually widen the Name tab.
  • In the include graph the hover popup just shows the filename, which is redundant if it's already visible. It should (maybe in addition) show the full path. (A similar popup would be useful in other places like Units when you have several CUs with the same filename.)
  • Imho the default sorting order should be Duration/Accumulated descending, as this is probably the most useful metric to find the places to start optimizing.
  • Table sorting performance could be better, Optimize Function has 1 million entries and takes a while to sort. If you click multiple times the app is rather unusable for a while until it catches up.
  • In Parse Template the top entry is <unknown>, not sure what to make of that. When I look at the max json file it seems fine.
  • It shows total build time as around 3 minutes while the build actually took like 20. Not sure where that number comes from. The aggregated cost of multiple hours of cpu time seems about right otoh.
  • Can't copy a whole row of a table.

Compile Score window crashes MSVC

MSVC crashes when I

  • drag the Compile Score window to a docking space
  • right-click a column header in the Compile Score window

Installed version is 1.5.6.

Kind regards, Benni

Incredibuild (or other distributed compilation) support

Currently when I build a project with IB, CompileScore will only show the results from my machine, so I can choose between partial data, or a 7 hours build time.
Is it possible to add Incredibuild support? Awesome plugin btw.

Compile Score Timeline has unrelated files listed

image

The files listed in the timeline aren't related to or included by each other -- it seems like maybe the database got corrupted, or somehow a pointer to a data structure is pointing to the wrong element.

Here, we see one cpp file ostensibly including a couple of totally separate CPP files (which in reality are not included by each other), and eventually building some bullet code -- which, again, is unrelated to everything above it in this hierarchy.

Show absolute path for includes

I've been using CompileScore for some time now to profile compile times in my personal projects, excellent tool and amazing job developing it.

One thing I've found is that headers with the same name but different path are hard to tell apart, e.g. a header called string.h that lives in one path and another in another path will get bundled together. However, if string.h is included via the <> then they seem to appear as separate includes.

The other issue is that even if they appeared as different in the image below, it's hard to tell which one is which, so another suggestion is to (optionally?) show absolute paths in the columns to be able to properly tell which one is which.

image

Thanks again!

System.Runtime.InteropServices.COMException on 'Copy Full Path' and 'Copy Name'

Intermittent crash if 'Copy Full Path' or 'Copy Name' are pressed multiple times. Crashes consistently between 2-10 copies.

CompileScore.exe!CompileScore.Overview.CompileDataTable.DataGridRow_ContextMenu.AnonymousMethod__4(object a, System.EventArgs b) Line 258 C#

System.Runtime.InteropServices.COMException: 'OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))'

OutputFile.scor works fine in Compiler Score binary, but doesn't load properly in VS extension

Unsure why, but the VS extension seems to have trouble loading external files that the Compiler Score file loads properly.

Related to that, I'm not able to get any timings inline in the source files at all.

  • And, "Show Timeline" is greyed out in the context menu

It seems hard to get it the .vsix extension to work at all with an externally generated score file -- it would be nice if the UI had an explicit "load from file" or "reload from file" button.

aggregate template instantiations

Just looked at Instance Function and there were many individual entries of the form class<T>::method<U>.
It would be nice to have the option to aggregate them by method, by class or both (displayed like class<...>::method<...>).

Gatherer::OnCompilerPassEnded - nullptr exception

Excellent project

TLDR

Noticed this crash on:

FinalizeTU(m_activeTU->timeline.name);

if m_activeTU is null => m_activeTUI->timeline.name will crash. Changed it to

if (m_activeTU && category == CompileCategory::BackEnd)
{ 
  FinalizeTU(m_activeTU->timeline.name);
}

Investigation

Only did a quick perusal. Looks like OnCompilerPassEnded gets called with said translation unit before OnCompilerPassStart() for the backend phase. I added tracepoints around the specific file that causes the crash in the start phase and the finalize phase as I initially thought it might've been prematurely dealloced or removed or something but they were never triggered first

Unsure if a deeper logic error exists or if something else is malformed as i'm not too familiar with build insights or this extensions source code

Two header with the same filename are considered being the same file in include view

Hello,
I have noticed a problem: when 2 headers have the same filename they are consider to be the same file.
For instance all the stdafx.h of my project are shown as one file in the include graph. Another example it happens for time.h which can be the libc one or the one in my project (including as #include <MyProject/Time.h>)

PS: Compile Score is incredible, thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.