Skip to content

Commit 619d216

Browse files
committed
Fixed Clang extraction with new types messing with the timeline
New types added that are not stackable are now moved to a different thread in the timelines to avoid messing up with the rest of the stats
1 parent 2972cb8 commit 619d216

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

DataExtractor/src/Extractors/ClangScore.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "../Common/CommandLine.h"
44
#include "../Common/Context.h"
5+
#include "../Common/CRC64.h"
56
#include "../Common/DirectoryUtils.h"
67
#include "../Common/JsonParser.h"
78
#include "../Common/IOStream.h"
@@ -262,11 +263,35 @@ namespace Clang
262263
return phase;
263264
}
264265

266+
// -----------------------------------------------------------------------------------------------------------
267+
U8 GetTrack( const CompileEvent& compileEvent )
268+
{
269+
//Move some events to a different track
270+
271+
enum AlternativeTrackNames : U64
272+
{
273+
ParseDeclaration = Hash::CreateCompileTimeCRC64( "ParseDeclarationOrFunctionDefinition" ),
274+
ParseFunction = Hash::CreateCompileTimeCRC64( "ParseFunctionDefinition" ),
275+
};
276+
277+
if( compileEvent.category == CompileCategory::Other && ( compileEvent.nameHash == ParseDeclaration || compileEvent.nameHash == ParseFunction ) )
278+
{
279+
return 1u;
280+
}
281+
282+
return 0u;
283+
}
284+
265285
// -----------------------------------------------------------------------------------------------------------
266286
void AddEventToTimeline(ScoreTimeline& timeline, const CompileEvent& compileEvent)
267287
{
288+
const U8 track = GetTrack(compileEvent);
289+
290+
//Make sure we have the track ready for this upcoming event
291+
while( track >= timeline.tracks.size() ) { timeline.tracks.emplace_back(); }
292+
268293
//inject in a sorted position
269-
TCompileEvents& events = timeline.tracks[0];
294+
TCompileEvents& events = timeline.tracks[ track ];
270295
TCompileEvents::iterator found = fastl::lower_bound(events.begin(),events.end(),compileEvent,
271296
[=](const CompileEvent& input, const CompileEvent& value)
272297
{
@@ -332,7 +357,6 @@ namespace Clang
332357
CompileUnitContext context;
333358

334359
ScoreTimeline timeline;
335-
timeline.tracks.emplace_back(); //we only use one events track in Clang
336360

337361
fastl::string inputPath{path};
338362
StringUtils::NormalizePath(inputPath);

0 commit comments

Comments
 (0)