Пример #1
0
static void init_oio_data(struct oio_data *oio, int n)
{
	int i;

	for (i = 0; i < n; i++) {
		oio[i].time = 0;
		oio[i].op[READ] = new_hist();
		oio[i].op[WRITE] = new_hist();
	}
}
Пример #2
0
int				main(int ac, char **av, char **env)
{
	t_shell		*shell;
	char		*line;

	if (ac == 1)
	{
		av++;
		line = NULL;
		shell = init(env);
		while (42)
		{
			re_init(shell);
			ft_prompt(shell);
			if (!shell->hist || (shell->hist->str && *shell->hist->str))
				new_hist(shell);
			else if (shell->hist && shell->hist->str)
				ft_memdel((void **)&shell->hist->str);
			line = get_line(shell, 0);
			if (line && (shell->tree = lexor_and_parsor(shell, &line)))
				main_execution(&shell);
		}
	}
	ft_putmsg(USAGE, NULL);
	return (0);
}
Пример #3
0
void
histogram_set_t::init ()
{
  assert (_resolutions.size () > 0);
  _current = new_hist ();
  qsort (_resolutions.base (), _resolutions.size (), sizeof (int), qcmp);
  _history.setsize (_resolutions.size ());
}
Пример #4
0
void
histogram_set_t::cycle_histograms ()
{
  if (okwstime () - _current->start () > _resolutions[0]) {
    _history[0].push_back (_current);
    for (size_t s = 0 ; s < _history.size () - 1; s++) {
      ptr<histogram_t> sum, h;
      while (_history[s].size () &&
	     okwstime () - _history[s][0]->start () > _resolutions[s+1]) {
	h = _history[s].pop_front ();
	if (!sum) sum = h;
	else { sum->combine (*h); }
      }
      if (sum) {
	ptr<histogram_t> nxt = _history[s+1].front ();
	if (nxt) nxt->combine (*sum);
	else _history[s+1].push_back (sum);
      }
    }
    assert (_history.back ().size () <= 1);
    _current = new_hist ();
  }
}