Commit Graph

13 Commits

Author SHA1 Message Date
Jun Wu
d8e775f423 tracing-collector: limit maximum count of spans
Summary:
Some functions might be called very frequently. For example,
`phases.phasecache.loadphaserevs` might be called 100k+ times.
That makes the tracing data harder to process.

Limit the count of spans to 1k by default so the data is cheaper to process,
and some highly repetitive cases can now be reasoned about. Note the limit
is only put on static Span Ids. If a span uses dynamic metadata or ask for
different Span Ids each time, they will not be limited.

In debugshell,

  td = %trace repo.revs('smartlog()')
  len(td.serialize())

dropped from 6MB to 0.87MB.

It's also possible to reason about:

  td = %trace len(repo.revs('ancestors(.)'))

in debugshell (taking 30s, 98KB serialized, vs 21s without tracing), while
previously the result would be too large to show (`%trace` just hangs).

Reviewed By: DurhamG

Differential Revision: D23307793

fbshipit-source-id: 3c1e9885ce7a275c2abd8935a4e4539a4f14ce83
2020-08-27 18:14:29 -07:00
Jun Wu
3376363721 tracing-collector: add is_event to TreeSpan
Summary: Expose the is_event property via public APIs.

Reviewed By: DurhamG

Differential Revision: D19797705

fbshipit-source-id: f441825e98208964f7b3d6815a177b464430cbb7
2020-03-12 12:19:38 -07:00
Jun Wu
7a12c33163 dev-logger: a simple library to enable env_logger for testing
Summary:
The tracing / env_logger integration works for hg as a binary. However I'd also
like to use it in library tests. This crate makes it easier to do so.

Reviewed By: xavierd

Differential Revision: D20286507

fbshipit-source-id: f5bf3288ce950591ddfe64b524ad51ce21ee4099
2020-03-10 14:16:38 -07:00
Jun Wu
97d0a976fd tracing: make it write to the log eco-system
Summary:
This means crates like env_logger (which reads $RUST_LOG, and writes to stderr)
can be used for convenient debugging.

Reviewed By: xavierd

Differential Revision: D20286514

fbshipit-source-id: e3b80cc4830ba5cc6dbf7aa1cbb92a4f4f046a54
2020-03-10 14:16:37 -07:00
Jun Wu
796f199130 tracing: save static metadata from tracing to Spans
Summary:
Those metadata include module_path, target, line number, etc, in Rust native
format.  They will be used for the upcoming `log` integration.

Reviewed By: xavierd

Differential Revision: D20286510

fbshipit-source-id: 27019b941bef08c0bb3e505bbdae642282dcb141
2020-03-10 14:16:36 -07:00
Jun Wu
918672b106 tracing-collector: support owned strings in TreeSpans
Summary:
TreeSpans used to use `&str`, which adds a lifetime to the struct, making it
harder to be used in the Python land. Use a type parameter so TreeSpans<String>
can be used.

Reviewed By: DurhamG

Differential Revision: D19797708

fbshipit-source-id: c66429abfaf16d876151ca6f29da976bed91485d
2020-02-28 09:16:14 -08:00
Jun Wu
4cd7df6a01 tracing-collector: rename structs
Summary:
TreeSpan -> RawTreeSpan; TreeSpanWithMeta -> TreeSpanRef.

I'm going to add a non-reference version of TreeSpanRef.

Differential Revision: D19797701

fbshipit-source-id: 42b04c23d4d0ddbe821b94fa2ccb133ce9eafa05
2020-02-28 09:16:14 -08:00
Jun Wu
957617c8b8 tracing-collector: support filtering in TreeSpans
Summary:
The filtering interface allows callsite to select what they want. It's similar
to manifest walk with files or directory matchers in source control.

Reviewed By: DurhamG

Differential Revision: D19784467

fbshipit-source-id: 5cf6e4016d6fa1c90f8aeccc50809baccd4af5ab
2020-02-28 09:16:13 -08:00
Jun Wu
366e701239 tracing-collector: support Events in TreeSpans
Summary: The idea is that instants (events) can be a drop-in replacement for `ui.log`.

Reviewed By: DurhamG

Differential Revision: D19782897

fbshipit-source-id: 795bbba23d921e460f723f19ef529b203aea366a
2020-02-28 09:16:13 -08:00
Jun Wu
d205592d42 tracing-collector: extract logic finding parent span to a function
Summary: This function will be reused by the next diff.

Reviewed By: DurhamG

Differential Revision: D19782895

fbshipit-source-id: 1e636eabee9b0dffd287a1e6784a24ab2259f51f
2020-02-28 09:16:13 -08:00
Jun Wu
8b5fdc01fc tracing-collector: put treespans into a struct
Summary: This allows us to define methods on the treespans, such as filtering APIs.

Reviewed By: DurhamG

Differential Revision: D19782896

fbshipit-source-id: 2e7bd8344c0196e382728c26a8233abf944bbf29
2020-02-28 09:16:12 -08:00
Jun Wu
69aa37f23b tracing: limit column width on ASCII output
Summary: This makes the output more readable even if the "name" of a span is very long.

Reviewed By: DurhamG

Differential Revision: D19780536

fbshipit-source-id: dce0d3777409c32b0752db51341a572addb823ea
2020-02-06 15:46:53 -08:00
Adam Simpkins
ab3a7cb21f Move fb-mercurial sources into an eden/scm subdirectory.
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
2019-11-13 16:04:48 -08:00