Closed
Bug 1210217
Opened 10 years ago
Closed 10 years ago
Create some kind of abstraction to avoid adding null elements to the output json by hand
Categories
(Core :: Gecko Profiler, defect)
Core
Gecko Profiler
Tracking
()
RESOLVED
FIXED
mozilla44
| Tracking | Status | |
|---|---|---|
| firefox44 | --- | fixed |
People
(Reporter: fitzgen, Assigned: fitzgen)
References
Details
Attachments
(1 file, 2 obsolete files)
|
10.85 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
We have all this code like:
if (aFrame.mCategory.isSome()) {
if (aFrame.mLine.isNothing()) {
mFrameTableWriter.NullElement(); // implementation
mFrameTableWriter.NullElement(); // optimizations
mFrameTableWriter.NullElement(); // line
}
mFrameTableWriter.IntElement(*aFrame.mCategory);
}
and it is fairly easy to forget to add null elements but we simultaneuosly have to add them all over the place everywhere.
I think we should have some kind of API like
abstraction.writeIntElement(CATEGORY, *aFrame.mCategory);
where CATEGORY is a constant int specifying which element in the array it is supposed to be, and the abstraction takes care of adding null elements for us.
| Assignee | ||
Comment 1•10 years ago
|
||
See bug 1209779 for one example of how easy it is to forget to add the nulls.
| Assignee | ||
Comment 2•10 years ago
|
||
Attachment #8668217 -
Flags: review?(shu)
| Assignee | ||
Comment 3•10 years ago
|
||
Comment 4•10 years ago
|
||
Comment on attachment 8668217 [details] [diff] [review]
Stop manually adding null entries to the profiler's JSON output
Review of attachment 8668217 [details] [diff] [review]:
-----------------------------------------------------------------
Please fix/double check the hasTrackedOptimizations case.
The rest is a nice improvement in readability.
::: tools/profiler/core/ProfileEntry.cpp
@@ +201,5 @@
> +// }
> +// ... etc ...
> +class MOZ_RAII AutoArraySchemaWriter
> +{
> + SpliceableJSONWriter& mJsonWriter;
nit: all-caps JSON
@@ +271,3 @@
>
> + AutoArraySchemaWriter writer(mWriter, mUniqueStrings);
> + writer.StringElement(Schema::STRATEGY, JS::TrackedStrategyString(strategy));
Huh, I thought |EnumName::VAL| syntax was only valid for enum classes, not bare enums.
@@ +561,5 @@
> ? "ion"
> : "baseline");
>
> if (jitFrame.hasTrackedOptimizations()) {
> + writer.FillUpTo(Schema::OPTIMIZATIONS);
I don't think this is right. This is the case of streaming a JIT frame. The schema is [location, impl, opts, line, category], and mUniqueStrings.WriteElement is used directly to write the location and the implementation above, so writer's mNextFreeIndex == 0, right? This seems like it would fill in 2 nulls.
Attachment #8668217 -
Flags: review?(shu)
| Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8669943 -
Flags: review?(shu)
| Assignee | ||
Updated•10 years ago
|
Attachment #8668217 -
Attachment is obsolete: true
| Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8669945 -
Flags: review?(shu)
| Assignee | ||
Updated•10 years ago
|
Attachment #8669943 -
Attachment is obsolete: true
Attachment #8669943 -
Flags: review?(shu)
| Assignee | ||
Comment 7•10 years ago
|
||
Comment 8•10 years ago
|
||
Comment on attachment 8669945 [details] [diff] [review]
Stop manually adding null entries to the profiler's JSON output
Review of attachment 8669945 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM
Attachment #8669945 -
Flags: review?(shu) → review+
| Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 9•10 years ago
|
||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 10•10 years ago
|
||
The patch landed yesterday with the wrong number - https://hg.mozilla.org/mozilla-central/rev/133773490619
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in
before you can comment on or make changes to this bug.
Description
•