function drawThreadEvents(ctx, events)
        {
            var quantizer = new WebInspector.Quantizer(timeOffset, quantTime, drawSample);
            var x = 0;
            var categoryIndexStack = [];
            var paths = [];
            var lastY = [];
            for (var i = 0; i < categoryOrder.length; ++i) {
                paths[i] = new Path2D();
                paths[i].moveTo(0, height);
                lastY[i] = height;
            }

            /**
             * @param {!Array<number>} counters
             */
            function drawSample(counters)
            {
                var y = baseLine;
                for (var i = idleIndex + 1; i < categoryOrder.length; ++i) {
                    var h = (counters[i] || 0) / quantTime * height;
                    y -= h;
                    paths[i].bezierCurveTo(x, lastY[i], x, y, x + quantSizePx / 2, y);
                    lastY[i] = y;
                }
                x += quantSizePx;
            }

            /**
             * @param {!WebInspector.TracingModel.Event} e
             */
            function onEventStart(e)
            {
                var index = categoryIndexStack.length ? categoryIndexStack.peekLast() : idleIndex;
                quantizer.appendInterval(e.startTime, index);
                categoryIndexStack.push(WebInspector.TimelineUIUtils.eventStyle(e).category._overviewIndex || otherIndex);
            }

            /**
             * @param {!WebInspector.TracingModel.Event} e
             */
            function onEventEnd(e)
            {
                quantizer.appendInterval(e.endTime, categoryIndexStack.pop());
            }

            WebInspector.TimelineModel.forEachEvent(events, onEventStart, onEventEnd);
            quantizer.appendInterval(timeOffset + timeSpan + quantTime, idleIndex);  // Kick drawing the last bucket.
            for (var i = categoryOrder.length - 1; i > 0; --i) {
                paths[i].lineTo(width, height);
                ctx.fillStyle = this._categoryColor(categories[categoryOrder[i]]);
                ctx.fill(paths[i]);
            }
        }
@param {!CanvasRenderingContext2D} ctx
@param {!Array<!WebInspector.TracingModel.Event>} events
@this {WebInspector.TimelineEventOverview}