Beispiel #1
0
/* entry point to render dashboard */
void
display_content (WINDOW * win, GLog * logger, GDash * dash,
                 GScrolling * scrolling)
{
   float max_percent = 0.0;
   int i, j, n = 0, process = 0;
   int win_h, win_w;
   getmaxyx (win, win_h, win_w);
   win_w = win_w;

   int y = 0, offset = 0, total = 0;
   int dash_scroll = scrolling->dash;

   werase (win);

   for (i = 0; i < TOTAL_MODULES; i++) {
      n = dash->module[i].idx_data;
      offset = 0;
      for (j = 0; j < dash->module[i].dash_size; j++) {
         if (dash_scroll > total) {
            offset++;
            total++;
         }
      }

      /* Every module other than VISITORS, BROWSERS and OS
       * will use total req as base
       */
      switch (i) {
       case VISITORS:
       case BROWSERS:
       case OS:
          process = g_hash_table_size (ht_unique_visitors);
          break;
       default:
          process = logger->process;
      }
      max_percent = set_percent_data (dash->module[i].data, n, process);
      dash->module[i].module = i;
      dash->module[i].max_hits = get_max_hit (dash->module[i].data, n);
      dash->module[i].hits_len = get_max_hit_len (dash->module[i].data, n);
      dash->module[i].data_len = get_max_data_len (dash->module[i].data, n);
      dash->module[i].perc_len = intlen ((int) max_percent) + 4;

      render_content (win, &dash->module[i], &y, &offset, &total, scrolling);
      if (y >= win_h)
         break;
   }
   wrefresh (win);
}
Beispiel #2
0
/* entry point to render dashboard */
void
display_content (WINDOW * win, GLog * logger, GDash * dash, GScroll * gscroll)
{
  GDashData *idata;
  GModule module;
  float max_percent = 0.0;
  int j, n = 0, process = 0;

  int y = 0, offset = 0, total = 0;
  int dash_scroll = gscroll->dash;

  werase (win);

  for (module = 0; module < TOTAL_MODULES; module++) {
    n = dash->module[module].idx_data;
    offset = 0;
    for (j = 0; j < dash->module[module].dash_size; j++) {
      if (dash_scroll > total) {
        offset++;
        total++;
      }
    }

    idata = dash->module[module].data;
    process = logger->process;
    max_percent = set_percent_data (idata, n, process);

    dash->module[module].module = module;
    dash->module[module].method_len = get_max_method_len (idata, n);
    dash->module[module].data_len = get_max_data_len (idata, n);
    dash->module[module].hits_len = get_max_hit_len (idata, n);
    dash->module[module].max_hits = get_max_hit (idata, n);
    dash->module[module].perc_len = get_max_perc_len (max_percent);
    dash->module[module].visitors_len = get_max_visitor_len (idata, n);

    render_content (win, &dash->module[module], &y, &offset, &total, gscroll);
  }
  wrefresh (win);
}