Skip to content

Commit a70f325

Browse files
authored
chore: cargo fmt (#152)
1 parent c47cd8e commit a70f325

File tree

6 files changed

+64
-69
lines changed

6 files changed

+64
-69
lines changed

src/encode/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
pub mod folded;
22
pub mod pprof;
33
pub mod profiles;
4-
5-

src/encode/profiles.rs

+45-46
Original file line numberDiff line numberDiff line change
@@ -9,71 +9,70 @@ pub struct Profile {
99
/// If one of the values represents the number of events represented
1010
/// by the sample, by convention it should be at index 0 and use
1111
/// sample_type.unit == "count".
12-
#[prost(message, repeated, tag="1")]
12+
#[prost(message, repeated, tag = "1")]
1313
pub sample_type: ::prost::alloc::vec::Vec<ValueType>,
1414
/// The set of samples recorded in this profile.
15-
#[prost(message, repeated, tag="2")]
15+
#[prost(message, repeated, tag = "2")]
1616
pub sample: ::prost::alloc::vec::Vec<Sample>,
1717
/// Mapping from address ranges to the image/binary/library mapped
1818
/// into that address range. mapping\[0\] will be the main binary.
19-
#[prost(message, repeated, tag="3")]
19+
#[prost(message, repeated, tag = "3")]
2020
pub mapping: ::prost::alloc::vec::Vec<Mapping>,
2121
/// Useful program location
22-
#[prost(message, repeated, tag="4")]
22+
#[prost(message, repeated, tag = "4")]
2323
pub location: ::prost::alloc::vec::Vec<Location>,
2424
/// Functions referenced by locations
25-
#[prost(message, repeated, tag="5")]
25+
#[prost(message, repeated, tag = "5")]
2626
pub function: ::prost::alloc::vec::Vec<Function>,
2727
/// A common table for strings referenced by various messages.
2828
/// string_table\[0\] must always be "".
29-
#[prost(string, repeated, tag="6")]
29+
#[prost(string, repeated, tag = "6")]
3030
pub string_table: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3131
/// frames with Function.function_name fully matching the following
3232
/// regexp will be dropped from the samples, along with their successors.
3333
///
3434
/// Index into string table.
35-
#[prost(int64, tag="7")]
35+
#[prost(int64, tag = "7")]
3636
pub drop_frames: i64,
3737
/// frames with Function.function_name fully matching the following
3838
/// regexp will be kept, even if it matches drop_frames.
3939
///
4040
/// Index into string table.
41-
#[prost(int64, tag="8")]
41+
#[prost(int64, tag = "8")]
4242
pub keep_frames: i64,
4343
// The following fields are informational, do not affect
4444
// interpretation of results.
45-
4645
/// Time of collection (UTC) represented as nanoseconds past the epoch.
47-
#[prost(int64, tag="9")]
46+
#[prost(int64, tag = "9")]
4847
pub time_nanos: i64,
4948
/// Duration of the profile, if a duration makes sense.
50-
#[prost(int64, tag="10")]
49+
#[prost(int64, tag = "10")]
5150
pub duration_nanos: i64,
5251
/// The kind of events between sampled ocurrences.
5352
/// e.g [ "cpu","cycles" ] or [ "heap","bytes" ]
54-
#[prost(message, optional, tag="11")]
53+
#[prost(message, optional, tag = "11")]
5554
pub period_type: ::core::option::Option<ValueType>,
5655
/// The number of events between sampled occurrences.
57-
#[prost(int64, tag="12")]
56+
#[prost(int64, tag = "12")]
5857
pub period: i64,
5958
/// Freeform text associated to the profile.
6059
///
6160
/// Indices into string table.
62-
#[prost(int64, repeated, tag="13")]
61+
#[prost(int64, repeated, tag = "13")]
6362
pub comment: ::prost::alloc::vec::Vec<i64>,
6463
/// Index into the string table of the type of the preferred sample
6564
/// value. If unset, clients should default to the last sample value.
66-
#[prost(int64, tag="14")]
65+
#[prost(int64, tag = "14")]
6766
pub default_sample_type: i64,
6867
}
6968
/// ValueType describes the semantics and measurement units of a value.
7069
#[derive(Clone, PartialEq, ::prost::Message)]
7170
pub struct ValueType {
7271
/// Index into string table.
73-
#[prost(int64, tag="1")]
72+
#[prost(int64, tag = "1")]
7473
pub r#type: i64,
7574
/// Index into string table.
76-
#[prost(int64, tag="2")]
75+
#[prost(int64, tag = "2")]
7776
pub unit: i64,
7877
}
7978
/// Each Sample records values encountered in some program
@@ -84,32 +83,32 @@ pub struct ValueType {
8483
pub struct Sample {
8584
/// The ids recorded here correspond to a Profile.location.id.
8685
/// The leaf is at location_id\[0\].
87-
#[prost(uint64, repeated, tag="1")]
86+
#[prost(uint64, repeated, tag = "1")]
8887
pub location_id: ::prost::alloc::vec::Vec<u64>,
8988
/// The type and unit of each value is defined by the corresponding
9089
/// entry in Profile.sample_type. All samples must have the same
9190
/// number of values, the same as the length of Profile.sample_type.
9291
/// When aggregating multiple samples into a single sample, the
9392
/// result has a list of values that is the element-wise sum of the
9493
/// lists of the originals.
95-
#[prost(int64, repeated, tag="2")]
94+
#[prost(int64, repeated, tag = "2")]
9695
pub value: ::prost::alloc::vec::Vec<i64>,
9796
/// label includes additional context for this sample. It can include
9897
/// things like a thread id, allocation size, etc
99-
#[prost(message, repeated, tag="3")]
98+
#[prost(message, repeated, tag = "3")]
10099
pub label: ::prost::alloc::vec::Vec<Label>,
101100
}
102101
#[derive(Clone, PartialEq, ::prost::Message)]
103102
pub struct Label {
104103
/// Index into string table
105-
#[prost(int64, tag="1")]
104+
#[prost(int64, tag = "1")]
106105
pub key: i64,
107106
/// At most one of the following must be present
108107
///
109108
/// Index into string table
110-
#[prost(int64, tag="2")]
109+
#[prost(int64, tag = "2")]
111110
pub str: i64,
112-
#[prost(int64, tag="3")]
111+
#[prost(int64, tag = "3")]
113112
pub num: i64,
114113
/// Should only be present when num is present.
115114
/// Specifies the units of num.
@@ -120,65 +119,65 @@ pub struct Label {
120119
/// and apply appropriate unit conversions to these.
121120
///
122121
/// Index into string table
123-
#[prost(int64, tag="4")]
122+
#[prost(int64, tag = "4")]
124123
pub num_unit: i64,
125124
}
126125
#[derive(Clone, PartialEq, ::prost::Message)]
127126
pub struct Mapping {
128127
/// Unique nonzero id for the mapping.
129-
#[prost(uint64, tag="1")]
128+
#[prost(uint64, tag = "1")]
130129
pub id: u64,
131130
/// Address at which the binary (or DLL) is loaded into memory.
132-
#[prost(uint64, tag="2")]
131+
#[prost(uint64, tag = "2")]
133132
pub memory_start: u64,
134133
/// The limit of the address range occupied by this mapping.
135-
#[prost(uint64, tag="3")]
134+
#[prost(uint64, tag = "3")]
136135
pub memory_limit: u64,
137136
/// Offset in the binary that corresponds to the first mapped address.
138-
#[prost(uint64, tag="4")]
137+
#[prost(uint64, tag = "4")]
139138
pub file_offset: u64,
140139
/// The object this entry is loaded from. This can be a filename on
141140
/// disk for the main binary and shared libraries, or virtual
142141
/// abstractions like "\[vdso\]".
143142
///
144143
/// Index into string table
145-
#[prost(int64, tag="5")]
144+
#[prost(int64, tag = "5")]
146145
pub filename: i64,
147146
/// A string that uniquely identifies a particular program version
148147
/// with high probability. E.g., for binaries generated by GNU tools,
149148
/// it could be the contents of the .note.gnu.build-id field.
150149
///
151150
/// Index into string table
152-
#[prost(int64, tag="6")]
151+
#[prost(int64, tag = "6")]
153152
pub build_id: i64,
154153
/// The following fields indicate the resolution of symbolic info.
155-
#[prost(bool, tag="7")]
154+
#[prost(bool, tag = "7")]
156155
pub has_functions: bool,
157-
#[prost(bool, tag="8")]
156+
#[prost(bool, tag = "8")]
158157
pub has_filenames: bool,
159-
#[prost(bool, tag="9")]
158+
#[prost(bool, tag = "9")]
160159
pub has_line_numbers: bool,
161-
#[prost(bool, tag="10")]
160+
#[prost(bool, tag = "10")]
162161
pub has_inline_frames: bool,
163162
}
164163
/// Describes function and line table debug information.
165164
#[derive(Clone, PartialEq, ::prost::Message)]
166165
pub struct Location {
167166
/// Unique nonzero id for the location. A profile could use
168167
/// instruction addresses or any integer sequence as ids.
169-
#[prost(uint64, tag="1")]
168+
#[prost(uint64, tag = "1")]
170169
pub id: u64,
171170
/// The id of the corresponding profile.Mapping for this location.
172171
/// It can be unset if the mapping is unknown or not applicable for
173172
/// this profile type.
174-
#[prost(uint64, tag="2")]
173+
#[prost(uint64, tag = "2")]
175174
pub mapping_id: u64,
176175
/// The instruction address for this location, if available. It
177176
/// should be within \[Mapping.memory_start...Mapping.memory_limit\]
178177
/// for the corresponding mapping. A non-leaf address may be in the
179178
/// middle of a call instruction. It is up to display tools to find
180179
/// the beginning of the instruction if necessary.
181-
#[prost(uint64, tag="3")]
180+
#[prost(uint64, tag = "3")]
182181
pub address: u64,
183182
/// Multiple line indicates this location has inlined functions,
184183
/// where the last entry represents the caller into which the
@@ -187,48 +186,48 @@ pub struct Location {
187186
/// E.g., if memcpy() is inlined into printf:
188187
/// line\[0\].function_name == "memcpy"
189188
/// line\[1\].function_name == "printf"
190-
#[prost(message, repeated, tag="4")]
189+
#[prost(message, repeated, tag = "4")]
191190
pub line: ::prost::alloc::vec::Vec<Line>,
192191
/// Provides an indication that multiple symbols map to this location's
193192
/// address, for example due to identical code folding by the linker. In that
194193
/// case the line information above represents one of the multiple
195194
/// symbols. This field must be recomputed when the symbolization state of the
196195
/// profile changes.
197-
#[prost(bool, tag="5")]
196+
#[prost(bool, tag = "5")]
198197
pub is_folded: bool,
199198
}
200199
#[derive(Clone, PartialEq, ::prost::Message)]
201200
pub struct Line {
202201
/// The id of the corresponding profile.Function for this line.
203-
#[prost(uint64, tag="1")]
202+
#[prost(uint64, tag = "1")]
204203
pub function_id: u64,
205204
/// Line number in source code.
206-
#[prost(int64, tag="2")]
205+
#[prost(int64, tag = "2")]
207206
pub line: i64,
208207
}
209208
#[derive(Clone, PartialEq, ::prost::Message)]
210209
pub struct Function {
211210
/// Unique nonzero id for the function.
212-
#[prost(uint64, tag="1")]
211+
#[prost(uint64, tag = "1")]
213212
pub id: u64,
214213
/// Name of the function, in human-readable form if available.
215214
///
216215
/// Index into string table
217-
#[prost(int64, tag="2")]
216+
#[prost(int64, tag = "2")]
218217
pub name: i64,
219218
/// Name of the function, as identified by the system.
220219
/// For instance, it can be a C++ mangled name.
221220
///
222221
/// Index into string table
223-
#[prost(int64, tag="3")]
222+
#[prost(int64, tag = "3")]
224223
pub system_name: i64,
225224
/// Source file containing the function.
226225
///
227226
/// Index into string table
228-
#[prost(int64, tag="4")]
227+
#[prost(int64, tag = "4")]
229228
pub filename: i64,
230229
/// Line number in source file.
231-
#[prost(int64, tag="5")]
230+
#[prost(int64, tag = "5")]
232231
pub start_line: i64,
233232
}
234233
// @@protoc_insertion_point(module)

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ pub use error::{PyroscopeError, Result};
4747

4848
// Public modules
4949
pub mod backend;
50+
pub mod encode;
5051
pub mod error;
5152
pub mod pyroscope;
5253
pub mod session;
5354
pub mod timer;
54-
pub mod encode;
5555

5656
// Private modules
5757
mod utils;

src/timer/kqueue.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,14 @@ impl Timer {
7474
Ok(_) => {
7575
log::trace!(target: LOG_TAG, "Sent event to listener @ {:?}", &tx)
7676
}
77-
Err(_e) => {}
78-
// There could be a less confusing message, or this
79-
// refactored to avoid a first sender
80-
//log::warn!(
81-
//target: LOG_TAG,
82-
//"Failed to send event to listener @ {:?} - {}",
83-
//&tx,
84-
//e
85-
//),
77+
Err(_e) => {} // There could be a less confusing message, or this
78+
// refactored to avoid a first sender
79+
//log::warn!(
80+
//target: LOG_TAG,
81+
//"Failed to send event to listener @ {:?} - {}",
82+
//&tx,
83+
//e
84+
//),
8685
}
8786
});
8887

src/timer/sleep.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,14 @@ impl Timer {
7272
Ok(_) => {
7373
log::trace!(target: LOG_TAG, "Sent event to listener @ {:?}", &tx)
7474
}
75-
Err(_e) => {}
76-
// There could be a less confusing message, or this
77-
// refactored to avoid a first sender
78-
//log::warn!(
79-
//target: LOG_TAG,
80-
//"Failed to send event to listener @ {:?} - {}",
81-
//&tx,
82-
//e
83-
//),
75+
Err(_e) => {} // There could be a less confusing message, or this
76+
// refactored to avoid a first sender
77+
//log::warn!(
78+
//target: LOG_TAG,
79+
//"Failed to send event to listener @ {:?} - {}",
80+
//&tx,
81+
//e
82+
//),
8483
}
8584
});
8685

src/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ pub fn pthread_self() -> Result<u64> {
8585
Ok(thread_id)
8686
}
8787

88-
8988
#[cfg(target_os = "windows")]
9089
pub fn pthread_self() -> Result<u64> {
91-
let thread_id = check_err(unsafe { winapi::um::processthreadsapi::GetCurrentThreadId() })? as u64;
90+
let thread_id =
91+
check_err(unsafe { winapi::um::processthreadsapi::GetCurrentThreadId() })? as u64;
9292
Ok(thread_id)
9393
}
9494

0 commit comments

Comments
 (0)