Пример #1
0
namespace DataKinesis {
int Logger::runOnceInd = runOnce();
int Logger::runOnce() {
	LOG(INFO) << "Registered logger";
	el::Loggers::getLogger("Logger");
	return 0;
}
Logger::Logger() {
	LOG(INFO) << "Logger ctor";
}
Logger::Logger(int argc, char** argv) {
	START_EASYLOGGINGPP(argc,argv);
	LOG(INFO) << "Logger ctor(argc,argv)";
}
Logger::~Logger() {
	LOG(INFO) << "Logger dtor";
}
void Logger::event(int a) {
	VLOG(1) << "Logger::event start";
	LOG(INFO) << "Process event["<<a<<"]";
	VLOG(1) << "Logger::event end";
}
el::base::type::StoragePointer Logger::getStorage() {
	return el::Helpers::storage();
}
}
Пример #2
0
void EventLoop::runForever()
{
    m_stop = false;

    while (!m_stop)
        runOnce();

    WARN << "Begin EventLoop Stop" ;

    map<int, Handler*>::iterator iter = m_map.begin();

    for(; iter!=m_map.end(); iter++)
    {
        Handler *handler = (*iter).second;

        DEBUG << "Stop fd: " << handler->getSocket().fd();

        m_selector->unRegisterEvent(handler, -1);

        handler->onCloseEvent(CLSSIG);
    }

    WARN << "End EventLoop Stop" ;

    m_map.clear();
}
Пример #3
0
void Primer::run()
{
	bool end = false;
	while (!end)
	{
		end = runOnce();
	}
}
Пример #4
0
void SimpleEventLoop::doRun(bool breakAfterEvents) {
	while (isRunning_) {
		{
			boost::unique_lock<boost::mutex> lock(eventAvailableMutex_);
			while (!eventAvailable_) {
				eventAvailableCondition_.wait(lock);
			}

			eventAvailable_ = false;
		}
		runOnce();
		if (breakAfterEvents) {
			return;
		}
	}
}
Пример #5
0
/*
 *  ======== VIDENCCOPY_TI_process ========
 */
XDAS_Int32 VIDENCCOPY_TI_process(IVIDENC_Handle h, XDM_BufDesc *inBufs,XDM_BufDesc *outBufs, IVIDENC_InArgs *inArgs, IVIDENC_OutArgs *outArgs)
{
    XDAS_Int32 curBuf;
    XDAS_UInt32 minSamples;

#ifdef USE_ACPY3
    const Uint32 maxTransferChunkSize       = 0xffff;
    Uint32       thisTransferChunkSize      = 0x0;
    Uint32       remainingTransferChunkSize;
    Uint32       thisTransferSrcAddr, thisTransferDstAddr;

    ACPY3_Params params;
    VIDENCCOPY_TI_Obj *videncObj = (VIDENCCOPY_TI_Obj *)h;
#endif

    Log_print5(Diags_ENTRY, "[+E] VIDENCCOPY_TI_process(0x%x, 0x%x, 0x%x, "
            "0x%x, 0x%x)",
            (IArg)h, (IArg)inBufs, (IArg)outBufs, (IArg)inArgs, (IArg)outArgs);

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
        (outArgs->size != sizeof(*outArgs))) {

        Log_print2(Diags_ENTRY,
                "[+E] VIDENCCOPY_TI_process, unsupported size (0x%x, 0x%x)",
                (IArg)(inArgs->size), (IArg)(outArgs->size));

        return (IVIDENC_EFAIL);
    }

#ifdef USE_ACPY3
    /*
     * Activate Channel  scratch DMA channels.
     */
    //ACPY3_activate(videncObj->dmaHandle1D1D8B);
#endif

    /* outArgs->bytesGenerated reports the total number of bytes generated */
    outArgs->bytesGenerated = 0;

    /*
     * A couple constraints for this simple "copy" codec:
     *    - Video encoding presumes a single input buffer, so only one input
     *      buffer will be encoded, regardless of inBufs->numBufs.
     *    - Given a different size of an input and output buffers, only
     *      encode (i.e., copy) the lesser of the sizes.
     */



    for (curBuf = 0; (curBuf < inBufs->numBufs) &&
        (curBuf < outBufs->numBufs); curBuf++) {

        /* there's an available in and out buffer, how many samples? */
        minSamples = inBufs->bufSizes[curBuf] < outBufs->bufSizes[curBuf] ?
            inBufs->bufSizes[curBuf] : outBufs->bufSizes[curBuf];

#ifdef USE_ACPY3

#if 0
        thisTransferSrcAddr        = (Uint32)inBufs->bufs[curBuf];
        thisTransferDstAddr        = (Uint32)outBufs->bufs[curBuf];
        remainingTransferChunkSize = minSamples;

        while (remainingTransferChunkSize > 0) {

            if (remainingTransferChunkSize > maxTransferChunkSize) {
               thisTransferChunkSize = maxTransferChunkSize;
            }
            else {
               thisTransferChunkSize = remainingTransferChunkSize;
            }

            /* Configure the logical channel */
            params.transferType = ACPY3_1D1D;
            params.srcAddr      = (void *)thisTransferSrcAddr;
            params.dstAddr      = (void *)thisTransferDstAddr;
            params.elementSize  = thisTransferChunkSize;
            params.numElements  = 1;
            params.waitId       = 0;
            params.numFrames    = 1;

            remainingTransferChunkSize -= thisTransferChunkSize;
            thisTransferSrcAddr += thisTransferChunkSize;
            thisTransferDstAddr += thisTransferChunkSize;

            /* Configure logical dma channel */
            ACPY3_configure(videncObj->dmaHandle1D1D8B, &params, 0);

            /* Use DMA to copy data */
            ACPY3_start(videncObj->dmaHandle1D1D8B);

            /* wait for transfer to finish  */
            ACPY3_wait(videncObj->dmaHandle1D1D8B);
        }
        Log_print1(Diags_USER2, "[+2] VIDENCCOPY_TI_process> "
                "ACPY3 Processed %d bytes.", (IArg)minSamples);
#endif
#else
        Log_print3(Diags_USER2, "[+2] VIDENCCOPY_TI_process> "
                "memcpy (0x%x, 0x%x, %d)",
                (IArg)(outBufs->bufs[curBuf]), (IArg)(inBufs->bufs[curBuf]),
                (IArg)minSamples);

        /* process the data: read input, produce output */
        memcpy(outBufs->bufs[curBuf], inBufs->bufs[curBuf], minSamples);
#endif

        outArgs->bytesGenerated += minSamples;
    }


#ifdef USE_ACPY3
    /*
     * Deactivate Channel  scratch DMA channels.
     */
    //ACPY3_deactivate(videncObj->dmaHandle1D1D8B);

	//videncObj->p_data //avi mem

	runOnce(videncObj->p_data, videncObj->p_ddr_data, videncObj->p_DARAM0, videncObj->dmaHandle1D1D8B);
	DspModule(inBufs->bufs[0], outBufs->bufs[0]);

	//memcpy(outBufs->bufs[0] + 8,&(videncObj->p_DARAM0),4);
	runOver();

#endif


	

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->encodedFrameType = 0;    /* TODO */
    outArgs->inputFrameSkip = IVIDEO_FRAME_ENCODED;
    outArgs->reconBufs.numBufs = 0;   /* important: indicate no reconBufs */
    return (IVIDENC_EOK);
}
Пример #6
0
#include "mylib.hpp"
#include "easylogging++.h"

INITIALIZE_EASYLOGGINGPP

int MyLib::runOnceHelper = runOnce();

int MyLib::runOnce() {
    LOG(INFO) << "Registering logger [mylib]";
    el::Loggers::getLogger("mylib");
    return 0;
}

MyLib::MyLib() {
    LOG(INFO) << "---MyLib Constructor () ---";
}

MyLib::MyLib(int argc, char** argv) {
    START_EASYLOGGINGPP(argc, argv);
    LOG(INFO) << "---MyLib Constructor(int, char**) ---";
}

MyLib::~MyLib() {
    LOG(INFO) << "---MyLib Destructor---";
}


void MyLib::event(int a) {
    VLOG(1) << "MyLib::event start";
    LOG(INFO) << "Processing event [" << a << "]";
    VLOG(1) << "MyLib::event end";
Пример #7
0
int Runtime::runShell(const char *startupBas, int fontScale, int debugPort) {
  logEntered();

  os_graphics = 1;
  os_color_depth = 16;
  opt_interactive = true;
  opt_usevmt = 0;
  opt_file_permitted = 1;
  opt_graphics = true;
  opt_pref_bpp = 0;
  opt_nosave = true;

  _output->setTextColor(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);
  _output->setFontSize(getStartupFontSize(_window));
  _initialFontSize = _output->getFontSize();
  if (fontScale != 100) {
    _fontScale = fontScale;
    int fontSize = (_initialFontSize * _fontScale / 100);
    _output->setFontSize(fontSize);
  }

  SDL_Init(SDL_INIT_AUDIO);
  SDL_AudioSpec desiredSpec;
  desiredSpec.freq = FREQUENCY;
  desiredSpec.format = AUDIO_S16SYS;
  desiredSpec.channels = 1;
  desiredSpec.samples = 2048;
  desiredSpec.callback = audio_callback;

  SDL_AudioSpec obtainedSpec;
  SDL_OpenAudio(&desiredSpec, &obtainedSpec);
  net_init();

  if (debugPort > 0) {
    appLog("Debug active on port %d\n", debugPort);
    g_lock = SDL_CreateMutex();
    g_cond = SDL_CreateCond();
    opt_trace_on = 1;
    g_debugBreak = SDL_TRUE;
    SDL_Thread *thread =
      SDL_CreateThread(debugThread, "DBg", (void *)(intptr_t)debugPort);
    SDL_DetachThread(thread);
  }

  if (startupBas != NULL) {
    String bas = startupBas;
    if (opt_ide == IDE_INTERNAL) {
      runEdit(bas.c_str());
    } else {
      runOnce(bas.c_str());
    }
    while (_state == kRestartState) {
      _state = kActiveState;
      if (_loadPath.length() != 0) {
        bas = _loadPath;
      }
      runOnce(bas.c_str());
    }
  } else {
    runMain(MAIN_BAS);
  }

  if (debugPort > 0) {
    SDL_DestroyCond(g_cond);
    SDL_DestroyMutex(g_lock);
  }

  debugStop();
  net_close();
  SDL_CloseAudio();
  _state = kDoneState;
  logLeaving();
  return _fontScale;
}
Пример #8
0
Tactic* Tactic::run(){
    if (timesToRun < 1){
        return runOnce();
    }
    else return runNTimes(timesToRun);
}
void TestRunner::doRuns(const size_t num_runs, const bool measure_cache_misses) {
  for (size_t run = 0; run < num_runs; ++run) {
    run_stats_.push_back(runOnce(measure_cache_misses));
  }
}