Beispiel #1
0
void import() {
  unique_ptr<Driver> driver(Driver::create_driver(FLAGS_driver));
  Status status = driver->connect();
  if (!status.ok()) {
    LOG(ERROR) << "Failed to connect:" << status.message();
    return;
  }
  auto num_clients = get_total_clients();
  int num_files = FLAGS_records_per_index;
  vector<string> files;
  if (num_clients > 0) {
    num_files /=  num_clients;
    files.reserve(num_files);
    int my_rank = get_rank();
    LOG(ERROR) << "my rank: " << my_rank << " total: " << num_clients;
    for (int i = my_rank * num_files; i < (my_rank + 1) * num_files; i++) {
      files.emplace_back(FLAGS_path + "/file-" + lexical_cast<string>(i));
    }
    LOG(ERROR) << "INsert from " << *files.begin() << " to " << files.back();
  } else {
    files.reserve(FLAGS_records_per_index);
    for (int i = 0; i < FLAGS_records_per_index; i++) {
      files.emplace_back(FLAGS_path + "/file-" + lexical_cast<string>(i));
    }
  }
  driver->import(files);
}
Beispiel #2
0
void ScopeEngine::init_packages()
{
	for(int i = 0; i < LoadServer::get_total_packages(); i++)
	{
		ScopePackage *pkg = (ScopePackage*)get_package(i);
		pkg->row1 = gui->output_frame->get_h() * i / LoadServer::get_total_packages();
		pkg->row2 = gui->output_frame->get_h() * (i + 1) / LoadServer::get_total_packages();
	}

	for(int i = 0; i < get_total_clients(); i++)
	{
		ScopeUnit *unit = (ScopeUnit*)get_client(i);
		for(int j = 0; j < HIST_SECTIONS; j++)
			bzero(unit->bins[j], sizeof(int) * TOTAL_BINS);
	}
}
Beispiel #3
0
void HistogramEngine::init_packages()
{
	for(int i = 0; i < get_total_packages(); i++)
	{
		HistogramPackage *package = (HistogramPackage*)get_package(i);
		package->start = data->get_h() * i / get_total_packages();
		package->end = data->get_h() * (i + 1) / get_total_packages();
	}

// Initialize clients here in case some don't get run.
	for(int i = 0; i < get_total_clients(); i++)
	{
		HistogramUnit *unit = (HistogramUnit*)get_client(i);
		for(int i = 0; i < 5; i++)
			bzero(unit->accum[i], sizeof(int64_t) * HISTOGRAM_RANGE);
	}
}
Beispiel #4
0
void ScopeEngine::process()
{
	process_packages();
	
	for(int i = 0; i < HIST_SECTIONS; i++)
		bzero(gui->bins[i], sizeof(int) * TOTAL_BINS);

	for(int i = 0; i < get_total_clients(); i++)
	{
		ScopeUnit *unit = (ScopeUnit*)get_client(i);
		for(int j = 0; j < HIST_SECTIONS; j++)
		{
			for(int k = 0; k < TOTAL_BINS; k++)
			{
				gui->bins[j][k] += unit->bins[j][k];
			}
		}
	}
}
Beispiel #5
0
void IVTCEngine::init_packages()
{
	int increment = plugin->input->get_h() / get_total_packages();
	increment /= 2;
	increment *= 2;
	if(!increment) increment = 2;
	int y1 = 0;
	for(int i = 0; i < get_total_packages(); i++)
	{
		IVTCPackage *package = (IVTCPackage*)get_package(i);
		package->y1 = y1;
		y1 += increment;
		if(y1 > plugin->input->get_h()) y1 = plugin->input->get_h();
		package->y2 = y1;
	}
	for(int i = 0; i < get_total_clients(); i++)
	{
		IVTCUnit *unit = (IVTCUnit*)get_client(i);
		unit->clear_totals();
	}
}
Beispiel #6
0
void HistogramEngine::process_packages(VFrame *data)
{
	this->data = data;
	LoadServer::process_packages();
	for(int i = 0; i < 5; i++)
	{
		bzero(accum[i], sizeof(int64_t) * HISTOGRAM_RANGE);
	}

	for(int i = 0; i < get_total_clients(); i++)
	{
		HistogramUnit *unit = (HistogramUnit*)get_client(i);
		for(int k = 0; k < 5; k++)
		{
			for(int j = 0; j < HISTOGRAM_RANGE; j++)
			{
				accum[k][j] += unit->accum[k][j];
			}
		}
	}

}