- Very ugly, uses reflection and is limited to the few
implementatations that come with Ant itself or and testutils
- Intended as a starting point for fixing #1018
The old implementation had many limitations:
- Relayed ALL measuring logic to the client
- Used `synchronized` methods
- Was unable to measure nested operations without mixing values
- Mixed wall-clock and CPU time, which caused trouble when running
multithreaded analysis (negative values for non-meassured time)
- A separate `main` existed which was undocumented and unsupported.
So I reworked it and added some goodies along the way:
- When not running in benchmark mode, all operations are NOOPs
- Nested operations are the default. Total and self time are
differentiated. This allows and encourages to better track overhead (ie:
time spent in a loop over another timed operation)
- We can meassure call count along with custom counters, which add
meaning to metrics
- Wall clock time for total execution is separated from all other CPU
times
- All meassurements are done by the `TimeTracker` itself
- No `synchronized` use, all structs are thread-safe and lock as little
and sporadically as possible
- Categories can be split up by labels
- The tracker is generic, has little knowledge of what is being
tracked. Same applies to report rendering. This is extremely flexible to
add more and custom tracks in the future
- CLI runs log only to stderr, never to stdout
- Both Ant and CLI runs log only once, the root logger never gets a
hold of the logs, completely isolating PMD
- Define a generic `TokenFilter` interface in pmd-core
- Provide a base, extension-friendly `JavaCCTokenFilter` to process and
filter JavaCC token streams, honoring `CPD-OFF` and `CPD-ON` comments
- Refactor the `JavaTokenizer` to use `JavaCCTokenFilter` by extending
it and adding custom Java-specific token filters