qt ui: slow frame warning

pull/19878/head
Willem Melching 4 years ago
parent 2eb81aa1d3
commit e11b677e01
  1. 11
      selfdrive/ui/qt/home.cc
  2. 1
      selfdrive/ui/qt/home.hpp

@ -12,6 +12,8 @@
#include <QWidget> #include <QWidget>
#include "common/params.h" #include "common/params.h"
#include "common/timing.h"
#include "common/swaglog.h"
#include "home.hpp" #include "home.hpp"
#include "paint.hpp" #include "paint.hpp"
@ -223,6 +225,7 @@ void GLWindow::initializeGL() {
wake(); wake();
prev_draw_t = millis_since_boot();
timer->start(1000 / UI_FREQ); timer->start(1000 / UI_FREQ);
backlight_timer->start(BACKLIGHT_DT * 1000); backlight_timer->start(BACKLIGHT_DT * 1000);
} }
@ -270,6 +273,14 @@ void GLWindow::resizeGL(int w, int h) {
void GLWindow::paintGL() { void GLWindow::paintGL() {
if(GLWindow::ui_state.awake){ if(GLWindow::ui_state.awake){
ui_draw(&ui_state); ui_draw(&ui_state);
double cur_draw_t = millis_since_boot();
double dt = cur_draw_t - prev_draw_t;
if (dt > 66){
// warn on sub 15fps
LOGW("slow frame(%llu) time: %.2f", ui_state.sm->frame, dt);
}
prev_draw_t = cur_draw_t;
} }
} }

@ -41,6 +41,7 @@ private:
QtSound sound; QtSound sound;
bool onroad = true; bool onroad = true;
double prev_draw_t = 0;
// TODO: this shouldn't be here // TODO: this shouldn't be here
float brightness_b = 0; float brightness_b = 0;

Loading…
Cancel
Save