I'm trying to profile the redrawing of the TextView using Profile GPU rendering and systrace utils. There are two cases of redrawing. The first calls setText()
when clicking on the view, the second is triggered by the rx timer Observable.interval (1000, TimeUnit.MILLISECONDS)
. In the first case Profile GPU rendering shows a slight excess of 16ms (img 1), and systrace displays an "Expensive measure / layout pass" warning. When the timer is updated, the rendering time is significantly increased (img 2), but systrace no longer displays the "Expensive measure / layout pass" warning, and the "measure / layout" stage disappears from the chart altogether, but the "Scheduling delay" warning appears. What is the difference of calling the redraw in these cases?
timerLabel.setOnClickListener(v -> {
timerLabel.setText(TimeUtils.getTime(this.timerValue));
});
Observable.interval(1000, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.doOnNext(t -> {
timerLabel.setText(TimeUtils.getTime(this.timerValue));
})
.subscribe();