Clang's `-cc1 -print-stats` shows lots of useful internal data including basic `FileManager` stats. Since this layer caches some results, it is unclear how that information translates to actual filesystem accesses. This PR uses `llvm::vfs::TracingFileSystem` to provide that missing information. Similar mechanism is implemented for `clang-scan-deps`'s verbose mode (`-v`). IO contention proved to be a real bottleneck a couple of times already and this new feature should make those easier to detect in the future. The tracing VFS is inserted below the caching FS and above the real FS.
27 lines
1.0 KiB
C++
27 lines
1.0 KiB
C++
//===- DependencyScanningService.cpp - clang-scan-deps service ------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "clang/Tooling/DependencyScanning/DependencyScanningService.h"
|
|
#include "llvm/Support/TargetSelect.h"
|
|
|
|
using namespace clang;
|
|
using namespace tooling;
|
|
using namespace dependencies;
|
|
|
|
DependencyScanningService::DependencyScanningService(
|
|
ScanningMode Mode, ScanningOutputFormat Format,
|
|
ScanningOptimizations OptimizeArgs, bool EagerLoadModules, bool TraceVFS)
|
|
: Mode(Mode), Format(Format), OptimizeArgs(OptimizeArgs),
|
|
EagerLoadModules(EagerLoadModules), TraceVFS(TraceVFS) {
|
|
// Initialize targets for object file support.
|
|
llvm::InitializeAllTargets();
|
|
llvm::InitializeAllTargetMCs();
|
|
llvm::InitializeAllAsmPrinters();
|
|
llvm::InitializeAllAsmParsers();
|
|
}
|