Skip to content

Commit 632105c

Browse files
committed
Fix Windows build.
1 parent f6bf266 commit 632105c

File tree

4 files changed

+27
-59
lines changed

4 files changed

+27
-59
lines changed

fxprof-processed-profile/src/markers/dynamic_schema.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub struct DynamicSchemaMarkerSchema {
145145
pub table_label: Option<String>,
146146

147147
/// The marker fields. The values are supplied by each marker, in the marker's
148-
/// implementations of the `string_field_value` and `number_field_value` trait methods.
148+
/// implementations of `push_field_values`.
149149
pub fields: Vec<DynamicSchemaMarkerField>,
150150

151151
/// Any graph lines / segments created from markers of this type.

fxprof-processed-profile/src/markers/static_schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ pub trait Marker {
100100
/// flows ([`FlowId`]). You can use one of those types, or a tuple of them.
101101
type FieldsType: MarkerFieldsTrait;
102102

103-
/// The marker fields. The values are supplied by each marker, in the marker's
104-
/// implementations of the `string_field_value` and `number_field_value` trait methods.
103+
/// The marker fields. The values for the marker fields are returned by the
104+
/// marker's implementation of the `field_values` method.
105105
const FIELDS: Schema<Self::FieldsType>;
106106

107107
/// Any graph lines / segments created from markers of this type.

samply/src/windows/coreclr.rs

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ impl Display for GcType {
212212
pub struct CoreClrGcAllocMarker(StringHandle, f64);
213213

214214
impl Marker for CoreClrGcAllocMarker {
215+
type FieldsType = (StringHandle, f64);
216+
215217
const UNIQUE_MARKER_TYPE_NAME: &'static str = "GC Alloc";
216218

217219
const CATEGORY: Category<'static> = CORE_CLR_GC_CATEGORY;
@@ -227,32 +229,26 @@ impl Marker for CoreClrGcAllocMarker {
227229
const TABLE_LABEL: Option<&'static str> =
228230
Some("GC Alloc: {marker.data.clrtype} ({marker.data.size} bytes)");
229231

230-
const FIELDS: &'static [MarkerField] = &[
232+
const FIELDS: Schema<Self::FieldsType> = Schema((
231233
MarkerField::string("clrtype", "CLR Type"),
232234
MarkerField::bytes("size", "Size"),
233-
];
235+
));
234236

235237
fn name(&self, profile: &mut Profile) -> StringHandle {
236238
profile.handle_for_string("GC Alloc")
237239
}
238240

239-
fn string_field_value(&self, _field_index: u32) -> StringHandle {
240-
self.0
241-
}
242-
243-
fn number_field_value(&self, _field_index: u32) -> f64 {
244-
self.1
245-
}
246-
247-
fn flow_field_value(&self, _field_index: u32) -> u64 {
248-
unreachable!()
241+
fn field_values(&self) -> (StringHandle, f64) {
242+
(self.0, self.1)
249243
}
250244
}
251245

252246
#[derive(Debug, Clone)]
253247
pub struct CoreClrGcEventMarker(StringHandle, StringHandle);
254248

255249
impl Marker for CoreClrGcEventMarker {
250+
type FieldsType = StringHandle;
251+
256252
const UNIQUE_MARKER_TYPE_NAME: &'static str = "GC Event";
257253

258254
const CATEGORY: Category<'static> = CORE_CLR_GC_CATEGORY;
@@ -266,23 +262,15 @@ impl Marker for CoreClrGcEventMarker {
266262
const TOOLTIP_LABEL: Option<&'static str> = Some("{marker.data.event}");
267263
const TABLE_LABEL: Option<&'static str> = Some("{marker.name} - {marker.data.event}");
268264

269-
const FIELDS: &'static [MarkerField] = &[MarkerField::string("event", "Event")];
265+
const FIELDS: Schema<Self::FieldsType> = Schema(MarkerField::string("event", "Event"));
270266

271267
fn name(&self, _profile: &mut Profile) -> StringHandle {
272268
self.0
273269
}
274270

275-
fn string_field_value(&self, _field_index: u32) -> StringHandle {
271+
fn field_values(&self) -> StringHandle {
276272
self.1
277273
}
278-
279-
fn number_field_value(&self, _field_index: u32) -> f64 {
280-
unreachable!()
281-
}
282-
283-
fn flow_field_value(&self, _field_index: u32) -> u64 {
284-
unreachable!()
285-
}
286274
}
287275

288276
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -722,6 +710,8 @@ pub fn handle_coreclr_event(
722710
pub struct OtherClrMarker(StringHandle, StringHandle);
723711

724712
impl Marker for OtherClrMarker {
713+
type FieldsType = StringHandle;
714+
725715
const UNIQUE_MARKER_TYPE_NAME: &'static str = "OtherClrMarker";
726716

727717
const CATEGORY: Category<'static> = Category("CLR", CategoryColor::Blue);
@@ -731,21 +721,13 @@ impl Marker for OtherClrMarker {
731721
const TOOLTIP_LABEL: Option<&'static str> = Some("{marker.data.name}");
732722
const TABLE_LABEL: Option<&'static str> = Some("{marker.name} - {marker.data.name}");
733723

734-
const FIELDS: &'static [MarkerField] = &[MarkerField::string("name", "Name")];
724+
const FIELDS: Schema<Self::FieldsType> = Schema(MarkerField::string("name", "Name"));
735725

736726
fn name(&self, _profile: &mut Profile) -> StringHandle {
737727
self.0
738728
}
739729

740-
fn string_field_value(&self, _field_index: u32) -> StringHandle {
730+
fn field_values(&self) -> StringHandle {
741731
self.1
742732
}
743-
744-
fn number_field_value(&self, _field_index: u32) -> f64 {
745-
unreachable!()
746-
}
747-
748-
fn flow_field_value(&self, _field_index: u32) -> u64 {
749-
unreachable!()
750-
}
751733
}

samply/src/windows/profile_context.rs

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::time::Duration;
55
use debugid::DebugId;
66
use fxprof_processed_profile::{
77
Category, CategoryColor, CategoryHandle, CounterHandle, CpuDelta, FrameFlags, LibraryHandle,
8-
LibraryInfo, Marker, Marker, MarkerField, MarkerFieldFormat, MarkerHandle, MarkerLocations,
9-
MarkerTiming, ProcessHandle, Profile, SamplingInterval, StringHandle, ThreadHandle, Timestamp,
8+
LibraryInfo, Marker, MarkerField, MarkerHandle, MarkerLocations, MarkerTiming, ProcessHandle,
9+
Profile, SamplingInterval, Schema, StringHandle, ThreadHandle, Timestamp,
1010
};
1111
use shlex::Shlex;
1212
use wholesym::PeCodeId;
@@ -1541,29 +1541,21 @@ impl ProfileContext {
15411541
pub struct VSyncMarker;
15421542

15431543
impl Marker for VSyncMarker {
1544+
type FieldsType = ();
1545+
15441546
const UNIQUE_MARKER_TYPE_NAME: &'static str = "Vsync";
15451547

15461548
const LOCATIONS: MarkerLocations = MarkerLocations::MARKER_CHART
15471549
.union(MarkerLocations::MARKER_TABLE)
15481550
.union(MarkerLocations::TIMELINE_OVERVIEW);
15491551

1550-
const FIELDS: &'static [MarkerField] = &[];
1552+
const FIELDS: Schema<Self::FieldsType> = Schema(());
15511553

15521554
fn name(&self, profile: &mut Profile) -> StringHandle {
15531555
profile.handle_for_string("Vsync")
15541556
}
15551557

1556-
fn string_field_value(&self, _field_index: u32) -> StringHandle {
1557-
unreachable!()
1558-
}
1559-
1560-
fn number_field_value(&self, _field_index: u32) -> f64 {
1561-
unreachable!()
1562-
}
1563-
1564-
fn flow_field_value(&self, _field_index: u32) -> u64 {
1565-
unreachable!()
1566-
}
1558+
fn field_values(&self) {}
15671559
}
15681560

15691561
let gpu_thread = self.gpu_thread_handle.get_or_insert_with(|| {
@@ -2198,29 +2190,23 @@ pub fn make_thread_label(
21982190
pub struct FreeformMarker(StringHandle, StringHandle);
21992191

22002192
impl Marker for FreeformMarker {
2193+
type FieldsType = StringHandle;
2194+
22012195
const UNIQUE_MARKER_TYPE_NAME: &'static str = "FreeformMarker";
22022196

22032197
const CHART_LABEL: Option<&'static str> = Some("{marker.data.values}");
22042198
const TOOLTIP_LABEL: Option<&'static str> = Some("{marker.name} - {marker.data.values}");
22052199
const TABLE_LABEL: Option<&'static str> = Some("{marker.name} - {marker.data.values}");
22062200

2207-
const FIELDS: &'static [MarkerField] = &[MarkerField::string("values", "Values")];
2201+
const FIELDS: Schema<Self::FieldsType> = Schema(MarkerField::string("values", "Values"));
22082202

22092203
fn name(&self, _profile: &mut Profile) -> StringHandle {
22102204
self.0
22112205
}
22122206

2213-
fn string_field_value(&self, _field_index: u32) -> StringHandle {
2207+
fn field_values(&self) -> StringHandle {
22142208
self.1
22152209
}
2216-
2217-
fn number_field_value(&self, _field_index: u32) -> f64 {
2218-
unreachable!()
2219-
}
2220-
2221-
fn flow_field_value(&self, _field_index: u32) -> u64 {
2222-
unreachable!()
2223-
}
22242210
}
22252211

22262212
fn extract_filename(path: &str) -> &str {

0 commit comments

Comments
 (0)