37
37
#include " llvm/ADT/StringRef.h"
38
38
#include " llvm/ADT/STLExtras.h"
39
39
#include " llvm/Support/MemoryBuffer.h"
40
+ #include " llvm/Support/NativeFormatting.h"
40
41
#include " llvm/Support/Path.h"
41
42
#include " llvm/Support/PrettyStackTrace.h"
42
43
#include " llvm/Support/raw_ostream.h"
@@ -2423,6 +2424,7 @@ void serializeSyntaxTreeAsJson(
2423
2424
const swift::syntax::SourceFileSyntax &SyntaxTree,
2424
2425
std::unordered_set<unsigned > ReusedNodeIds,
2425
2426
ResponseBuilder::Dictionary &Dict) {
2427
+ auto StartClock = clock ();
2426
2428
// 4096 is a heuristic buffer size that appears to usually be able to fit an
2427
2429
// incremental syntax tree
2428
2430
size_t ReserveBufferSize = 4096 ;
@@ -2438,6 +2440,15 @@ void serializeSyntaxTreeAsJson(
2438
2440
SyntaxTreeOutput << *SyntaxTree.getRaw ();
2439
2441
}
2440
2442
Dict.set (KeySerializedSyntaxTree, SyntaxTreeString);
2443
+
2444
+ auto EndClock = clock ();
2445
+ LOG_SECTION (" incrParse Performance" , InfoLowPrio) {
2446
+ Log->getOS () << " Serialized " << SyntaxTreeString.size () << " bytes in " ;
2447
+ llvm::write_double (Log->getOS (),
2448
+ (double )(EndClock - StartClock) * 1000 / CLOCKS_PER_SEC,
2449
+ llvm::FloatStyle::Fixed, 2 );
2450
+ Log->getOS () << " ms" ;
2451
+ }
2441
2452
}
2442
2453
2443
2454
void SKEditorConsumer::handleSyntaxTree (
0 commit comments