1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
//! Stage-timing profiling primitives for the file-group reader (perf harness).
//!
//! A single canonical write path for the per-stage wall-time counters, so the
//! `let s = Instant::now(); …; self.x [+]= s.elapsed()…` shape isn't copy-pasted
//! at every timing site. Inlining (rather than an RAII/`Drop` guard) is
//! deliberate: a guard holding `&mut self.field` for the scope would double-borrow
//! `self` against bodies that also need `&mut self` (e.g.
//! `process_queued_blocks_for_instant`); a macro releases the body's borrow before
//! the field write.
/// Record wall-us of `$body` once into the u64 place `$dst`.
///
/// Microseconds, not milliseconds: a metadata-table read completes in about 1.3ms
/// in release, where every millisecond-granular stage rounds to zero and the
/// counters say nothing about where the time went.
///
/// Where the body is a single fallible expression, keep `?` OUTSIDE the macro so
/// the elapsed time is still attributed on the error path.
/// Add wall-us of `$body` to the u64 place `$dst`.
///
/// The accumulating form, for a stage entered once per block or per window rather
/// than once per read. `profile_once!` assigns, so using it in a loop would report
/// only the last iteration.
pub use profile_add;
pub use profile_once;