Skip to content

Timeline markers - #275

Merged
gregtatum merged 7 commits into
firefox-devtools:masterfrom
gregtatum:timeline-markers
May 8, 2017
Merged

Timeline markers#275
gregtatum merged 7 commits into
firefox-devtools:masterfrom
gregtatum:timeline-markers

Conversation

@gregtatum

Copy link
Copy Markdown
Member

This is a work in progress for timeline markers. I need to clean up a bunch of stuff. @mikeconley this is here if you want to check it out, but I'm only showing TracingMarkers, or markers that we can determine have a start and end time. Your AsyncTabSwitch aren't being turned into TracingMarkers right now.

@codecov-io

codecov-io commented Apr 27, 2017

Copy link
Copy Markdown

Codecov Report

Merging #275 into master will increase coverage by 0.83%.
The diff coverage is 98.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
+ Coverage   71.08%   71.91%   +0.83%     
==========================================
  Files          59       60       +1     
  Lines        3247     3351     +104     
==========================================
+ Hits         2308     2410     +102     
- Misses        939      941       +2
Impacted Files Coverage Δ
src/content/profile-data.js 62.79% <ø> (ø) ⬆️
src/content/stack-timing.js 96.47% <ø> (ø) ⬆️
src/test/store/fixtures/profiles.js 100% <100%> (ø) ⬆️
src/test/unit/profile-data.js 100% <100%> (ø) ⬆️
src/content/reducers/timeline-view.js 92.85% <100%> (+2.85%) ⬆️
src/test/store/actions.js 100% <100%> (ø) ⬆️
src/content/actions/timeline.js 71.42% <100%> (+11.42%) ⬆️
src/content/reducers/profile-view.js 62.89% <100%> (+0.33%) ⬆️
src/content/marker-timing.js 94.11% <94.11%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51af0de...e15876f. Read the comment docs.

@gregtatum

gregtatum commented Apr 27, 2017

Copy link
Copy Markdown
Member Author

I pulled out the canvas logic into its own separate component. Next up is re-use the TimelineCanvas component for the TImelineFlameChart.

@gregtatum
gregtatum force-pushed the timeline-markers branch 2 times, most recently from 4fe9c72 to 7487dc5 Compare May 4, 2017 21:13
@gregtatum gregtatum changed the title [WIP] Timeline markers Timeline markers May 4, 2017
@gregtatum

Copy link
Copy Markdown
Member Author

This is now ready for review. This is a first pass and I have many follow-ups I would like to do. If you could be specific on review changes on what can be follow-ups I would appreciate it.

Follow-ups

  • Move labels to the left side area. This would change the markup for the area and some assumptions about the components. Although clutter-wise the current solution might make things cleaner.
  • Colors are preliminary.
  • Sort markers into a better order.
  • Group makers by type.
  • Marker thread sorting and hiding.
  • UserTimings have labels, but others do not.
  • Do we care about the duplicated strings, or should I move to unique strings?
  • At this point I really only need to draw charts that are in view.
  • Build out marker payload definitions.

@gregtatum
gregtatum requested review from julienw and mstange May 4, 2017 21:28
@julienw

julienw commented May 5, 2017

Copy link
Copy Markdown
Contributor

FlameChartCanvas.js seem to conflict a lot with current master.

@gregtatum

Copy link
Copy Markdown
Member Author

I think it's my recent PureComponent changes.

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left several comments, some of them perf related, others style related , others as suggestions.

I admit I haven't looked so much at the canvas code, I'll trust you on this.

The feature is quite cool and works fine. I'd rather see it in rather than make it perfect. So if you prefer to move some of my comments to follow-ups it's fine by me.

onDoubleClickItem={this.onDoubleClickStack}
getHoveredItemInfo={this.getHoveredStackInfo}
drawCanvas={this.drawCanvas}
hitTest={this.hitTest} />;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should all of the functions names be prefixed by an underscore ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be more consistent with the codebase. I'll update it. I'm not sure (from a bikeshedding point of view) of what utility underscore has for React classes' member functions, as the class instances are never used by anyone, so all class functions are implicitly private.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I usually don't care, but it's just what I've been told in this project ;)

}

.timelineCanvas.hover {
cursor: default;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: have you tried putting the "cursor: default" on the above block ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior here is to show the grab cursor on the Timeline when not hovering over a stack frame, then when you hover over a stack frame it changes to the default cursor.

const { className, drawCanvas } = this.props;
if (!this._requestedAnimationFrame) {
this._requestedAnimationFrame = true;
window.requestAnimationFrame(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional nit: you can assign to _requestedAnimationFrame the result of window.requestAnimationFrame.

_ctx: CanvasRenderingContext2D
state: {
hoveredItem: null | HoveredItem;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please put semicolons at the end of these lines

_ctx: null|CanvasRenderingContext2D
_textMeasurement: null | TextMeasurement

props: Props

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you put a semicolon at the end of these lines ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should have a linting rule in place that covers this. I looked for one briefly but didn't find one, although maybe we can just switch to prettier.

Comment thread src/content/containers/TimelineView.js Outdated
</div>
<Reorderable tagName='div'
className={`${className}ThreadList`}
className={'timelineViewTimelinesThreadList'}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you don't need the {} syntax, just put the class as a string :)

markerTimingRows = markerTimingRows.concat(value);
}
return markerTimingRows;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, but do you think you can split this function is several parts ? For example, the Map handling could be extracted into a higher-level component ?

// Handle different marker payloads.
switch (data.type) {
case 'UserTiming':
return (data: UserTimingMarkerPayload).name;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit: not sure the flow annotation is useful here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mainly did it as documentation, would it be better to leave this out?

Comment thread src/content/marker-timing.js Outdated
let markerTimingRows = [];
for (const [, value] of markerTimingsMap) {
markerTimingRows = markerTimingRows.concat(value);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this just work to flatten: [].concat(...marketTimingRows.values());
without intermediary arrays :)

query.react_perf = null;
/* eslint-enable camelcase */
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure this landed elsewhere :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

</div>
<div className={`${className}HeaderIntervalMarkerOverviewContainer ${className}HeaderIntervalMarkerOverviewContainerGfx`}>
{
{/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the tracing markers at the top until this tab is more polished.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, I knew I forgot something. Thanks I meant to bring this up. Will do.

user-select: none;
}

.timelineMarkersLabels > span {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please set a class name on the span instead.


_prepCanvas() {
const {canvas} = this.refs;
const {containerWidth, containerHeight} = this.props;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to pick one style here and add a lint for it. At the moment we have a wild mix of hugging braces and spaced braces.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'm ready to take on prettier at this point.

@gregtatum
gregtatum force-pushed the timeline-markers branch from 7487dc5 to e0329ea Compare May 8, 2017 18:51
@gregtatum
gregtatum force-pushed the timeline-markers branch from e0329ea to 7cba79f Compare May 8, 2017 19:10
@gregtatum
gregtatum force-pushed the timeline-markers branch from 7cba79f to e15876f Compare May 8, 2017 19:17
@gregtatum
gregtatum merged commit 004705f into firefox-devtools:master May 8, 2017
@gregtatum gregtatum mentioned this pull request May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants