Commit Graph

52 Commits

Author SHA1 Message Date
Ryan Mansfield
1001f9eb41 Add -print-zero-stats option and use it in ensure_no_astgen.swift
to verify ExportedSourceFileRequest == 0.

In release mode only non-zero stats are printed by default now.

Fix diagnostic when compiler is built without statistics support.
2024-10-15 23:11:15 -04:00
Slava Pestov
c77fae3a2d Basic: Add -fine-grained-timers flag
By default, -stats-output-dir does not collect per-request timers and
counters, because of overhead.
2024-09-23 18:04:25 -04:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Ben Langmuir
5a5dd13ca1 Include what you use: Optional and Hashing
Add a few includes of Optional.h and Hashing.h. These files are failing
ot build in the "next" branch due to changes in llvm's own includes, but
it's general goodness to include them on main as well.
2022-02-24 13:47:04 -08:00
Alex Hoppen
7ce0e872b7 [Statistic] Refactor to make getInstructionsExecuted publically available 2021-05-20 16:02:41 +02:00
Robert Widmann
638977454b Remove SharedTimer Infrastructure
Teach the UnifiedStatsReporter to directly construct
llvm::NamedRegionTimer for itself.
2020-07-16 17:35:50 -07:00
swift-ci
81a6a266aa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 18:23:23 -08:00
David Ungar
d61f6f2f66 Changes to support per-type-body fingerprints. 2020-01-27 15:14:46 -08:00
Mike Ash
cd2b54f74e Merge branch 'master' into master-rebranch 2020-01-24 11:30:32 -05:00
Hamish Knight
fe906574cd [Basic] Avoid reentrant stat collection
Currently `UnifiedStatsReporter::flushTracesAndProfiles`
can kick off requests when computing the source
ranges for collected entities, which will try to
record additional stats about the requests.

This currently happens to work without issue,
but #29289 bumped the counters down slightly such
that the vector storing the stats now performs a
re-allocation when we do a reentrant stat entry.
This then caused a use-after-free as we try to
continue iterating over the old buffer.

Fix this issue by refusing to record any new stats
while we're flushing out the ones we've already
recorded.
2020-01-23 16:43:18 -08:00
Adrian Prantl
468b74bd70 Update Swift master-next for upstream llvm.org changes. 2019-10-21 13:31:31 -07:00
Jason Mittertreiner
8998235ed6 Enable Child Memory Usage Tracking on Windows (#23686)
Windows requires a handle to get memory usage, so do a slight refactor
to collect the child's memory usage as it exits instead of as the parent
is cleaning up.
2019-03-30 18:54:30 -07:00
Andrew Trick
8de89c392a Add a scale-test validation test for quadratic behavior during inlining.
Adds a stat to SILInstruction's transferNodesFromList to record the
number of times an instruction is transfered to another block. This is
the only way I can think of to detect quadratic behavior of passes
that split basic blocks.
2018-11-26 15:24:41 -08:00
Mark Lacey
72ba110e5b [ConstraintSystem] Rework new constraint stat as a FRONTEND_STATISTIC.
In the process, remove the old incrementScopeCounter SWIFT_FUNC_STAT.
2018-10-18 07:18:02 -07:00
Mark Lacey
cc0386b461 [ConstraintSystem] Add a new stat to be used for expression type checker performance testing.
This counts the number of leaf scopes we reach while solving the
constraint sytem, and is a much better measure of the growth of
unnecessary work than the total number of scopes opened.

There were two tests where I had a difficult time getting scale-test
to fit the curve even after adjusting some of the parameters, so I've
left those to use the old stat for now.
2018-10-17 07:26:18 -07:00
Graydon Hoare
5a563f59af [Stats] Add SWIFTC_MAXIMUM_DETERMINISM to inhibit parallelism everywhere. 2018-09-13 16:15:49 -07:00
Graydon Hoare
388e357218 [Stats] Add UnifiedStatsReporter tracing/profiling machinery to request-evaluator. 2018-09-02 02:00:07 -07:00
Graydon Hoare
1c87229104 [Stats] Flush Stats profiles and tracers at SILModule lifecycle boundary. 2018-09-01 00:05:58 -07:00
Graydon Hoare
044157821e [Stats] Assert main-thread-only use of UnifiedStatsReporter. 2018-09-01 00:05:58 -07:00
Graydon Hoare
ffa1bf1979 [Stats] Expand and improve traceable-entity vocabulary. 2018-09-01 00:05:58 -07:00
swift-ci
115f220410 Merge remote-tracking branch 'origin/master' into master-next 2018-04-11 22:15:16 -07:00
Saleem Abdulrasool
a80dd5b963 Basic: attempt to repair inverted dependencies
When linking on Linux, we would fail with unresolved symbol references
to swift::FrontendStatsTracer::getTraceFormatter<T>. The use of the
types, which are defined in swiftSIL occur in swiftBasic.  Provide
inline definitions of the constructors which cause the dependency on
some environments (e.g. Linux).
2018-04-10 10:40:10 -07:00
swift-ci
c2a6871095 Merge remote-tracking branch 'origin/master' into master-next 2018-02-21 19:28:52 -08:00
Graydon Hoare
628c446fe3 [Stats] Add -profile-stats-{events,entities} 2018-02-21 16:22:48 -08:00
Graydon Hoare
7fe97c77c5 [Stats] Permit negative counters and deltas. 2018-02-21 14:49:24 -08:00
Graydon Hoare
dd85e946e7 [Stats] Replace nonstandard SharedTimers with FrontendStatsTracers. 2018-02-21 14:49:24 -08:00
Graydon Hoare
819275945d [Stats] Replace RecursiveSharedTimer with FrontendStatsTracer. 2018-02-21 14:49:24 -08:00
Graydon Hoare
deabc3fe65 [Stats] Add a recursive-timers registry to UnifiedStatsReporter. 2018-02-21 14:49:24 -08:00
Graydon Hoare
5f01c19d8e [Stats] Add support for tracing protocol conformances. 2018-02-21 14:49:24 -08:00
Graydon Hoare
76b82accbc [Stats] Simplify FrontendStatsTracer uses and formatter-definitions. 2018-02-21 14:49:24 -08:00
Bob Wilson
ac1376a7ce master-next: Update Statistic initializers for LLVM r323999.
LLVM r323999 changed the Initialized field of llvm::Statistic from a
bool to std::atomic<bool>.
2018-02-04 18:58:38 -08:00
Graydon Hoare
9334779f33 [Stats] Reduce layering violations in FrontendStatsTracer. 2018-01-30 01:54:07 -08:00
Graydon Hoare
5f130a8d35 [Stats] Expand FrontendStatsTracer to trace multiple entity-types. 2018-01-21 23:37:54 -08:00
Graydon Hoare
173e702da2 [Stats] Add a pair of counters to track failed processes. 2017-11-08 19:53:36 -08:00
David Ungar
443ab7d950 git-clang-format 2017-09-26 18:02:35 -07:00
David Ungar
2af86f5cac First compiling run, WIP 2017-09-26 16:07:07 -07:00
Graydon Hoare
205f725d6e [stats] Add UnifiedStatsReporter::FrontendStatsTracer 2017-09-22 19:15:34 -04:00
Graydon Hoare
7e1cf168a8 [stats] Factor out UnifiedStatsReporter fields to a .def file 2017-09-22 02:01:06 -04:00
Graydon Hoare
f236ee6278 Merge pull request #11570 from graydon/slocps
Add NumSourceLines{,PerSecond} counters, fix SourceFile counters for WMO mode
2017-08-24 14:44:47 -07:00
David Ungar
c3e3d45396 Instrument NominalTypeDecl::lookupDirect
Also implement RecursiveSharedTimer
2017-08-23 14:53:53 -07:00
Graydon Hoare
fecffc9c8b [Stats] Add NumSourceLines{,PerSecond} counters. 2017-08-22 16:39:00 -07:00
Graydon Hoare
e10f483477 [Stats] Mangle a little more information into the file & timer names.
This helps disambiguate files that might otherwise be hard to sort through
if multiple runs output stats together in a single directory. The names
don't have to be perfect, just contain sufficient hints (and be parseable)
to differentiate module, arch, opt and output-type variation in jobs.
2017-06-02 18:08:31 -07:00
Graydon Hoare
56460309bc [Stats] Add always-on statistic for NumLLVMBytesOutput. 2017-05-31 17:30:40 -07:00
Graydon Hoare
4de8689f38 [Stats] Add always-on statistic for ChildrenMaxRSS. 2017-05-31 17:30:40 -07:00
Graydon Hoare
b5292f04f8 Add an assortment of new "always-on" metrics. 2017-04-28 13:56:13 -07:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
Graydon Hoare
a30f17306d [Stats] Add UnifiedStatsReporter class. 2017-04-03 17:20:37 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00