Esempio n. 1
0
void AcdCallDataCollection::Method()
{
    acd_tool::m_logger.WriteLog(LOG_LEVEL_WARNING, __FILE__, __LINE__, __FUNCTION__,
        "acd data collection thread begin");
    const static int32_t timeout = 30;
    while (this->mIsLoop) {
        calldata_ptr callinfo;
        bool ret = _calldata_queue.UnBlockPop(callinfo, timeout);
        commit_data();
        if (ret) {
            update_data(callinfo);
        }
    }
}
Esempio n. 2
0
static void run_child(int id)
{
	unsigned num_blocks = file_size / block_size;
	char *buf;
	CLIENT *clnt;
	nfs_fh3 *fh;
	enum stable_how stable = UNSTABLE;

	if (sync_io) {
		stable = FILE_SYNC;
	}

	/* connect to NFS */
	clnt = clnt_create("9.155.61.98", NFS_PROGRAM, NFS_V3, "tcp");
	if (clnt == NULL) {
		printf("ERROR: failed to connect to NFS daemon on %s\n", "9.155.61.98");
		exit(10);
	}


	/* get the file filehandle */
	fh = lookup_fh(clnt, (nfs_fh3 *)mfh, fname);

	buf = malloc(block_size);
	memset(buf, 1, block_size);
	
	srandom(id ^ random());

	while (!run_finished) {
		unsigned offset = random() % num_blocks;
		if (write_data(clnt, fh, offset*(off_t)block_size, buf, block_size, stable) != block_size) {
			printf("write_data failed!\n");
			exit(1);
		}
		io_count[id]++;
		if (flush_blocks && io_count[id] % flush_blocks == 0) {
			commit_data(clnt, fh);
		}
	}

	return;
}
Esempio n. 3
0
//---------------------------------------------------------------------------
// Initialize the connector on the start of network life
void
NaPetriCnOutput::init ()
{
    // The same as in adjoint "input" for to be passive in the first
    // activation cycle
    idData = 0;

    // No adjoint connectors which processed the data
    nPrCnt = links();

    // Initial assignment and commit data
    if(bStarter)
      {
	NaPrintLog("node '%s', connector '%s' is << STARTER >>\n",
		   host()->name(), name());

	rData = rData0;
	commit_data();
      }
}