当前位置: 首页>>代码示例>>C++>>正文


C++ DmaManager::show_mem_stats方法代码示例

本文整理汇总了C++中DmaManager::show_mem_stats方法的典型用法代码示例。如果您正苦于以下问题:C++ DmaManager::show_mem_stats方法的具体用法?C++ DmaManager::show_mem_stats怎么用?C++ DmaManager::show_mem_stats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DmaManager的用法示例。


在下文中一共展示了DmaManager::show_mem_stats方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, const char **argv)
{
  int srcAlloc;
  unsigned int *srcBuffer = 0;

  MemreadRequestProxy *device = 0;
  DmaConfigProxy *dmap = 0;
  
  MemreadIndication *deviceIndication = 0;
  DmaIndication *dmaIndication = 0;

  fprintf(stderr, "Main::%s %s\n", __DATE__, __TIME__);

  device = new MemreadRequestProxy(IfcNames_MemreadRequest);
  dmap = new DmaConfigProxy(IfcNames_DmaConfig);
  DmaManager *dma = new DmaManager(dmap);

  deviceIndication = new MemreadIndication(IfcNames_MemreadIndication);
  dmaIndication = new DmaIndication(dma, IfcNames_DmaIndication);

  fprintf(stderr, "Main::allocating memory...\n");
  srcAlloc = portalAlloc(alloc_sz);
  srcBuffer = (unsigned int *)portalMmap(srcAlloc, alloc_sz);

  portalExec_start();

  for (int i = 0; i < numWords; i++){
    srcBuffer[i] = i;
  }
    
  portalDCacheFlushInval(srcAlloc, alloc_sz, srcBuffer);
  fprintf(stderr, "Main::flush and invalidate complete\n");

  unsigned int ref_srcAlloc = dma->reference(srcAlloc);
  fprintf(stderr, "ref_srcAlloc=%d\n", ref_srcAlloc);

  fprintf(stderr, "Main::starting read %08x\n", numWords);
  portalTimerStart(0);
  int burstLen = 16;
#ifndef BSIM
  int iterCnt = 64;
#else
  int iterCnt = 2;
#endif
  device->startRead(ref_srcAlloc, numWords, burstLen, iterCnt);
  sem_wait(&test_sem);
  uint64_t cycles = portalTimerLap(0);
  uint64_t beats = dma->show_mem_stats(ChannelType_Read);
  float read_util = (float)beats/(float)cycles;
  fprintf(stderr, "memory read utilization (beats/cycle): %f\n", read_util);

  MonkitFile("perf.monkit")
    .setHwCycles(cycles)
    .setReadBwUtil(read_util)
    .writeFile();

  exit(mismatchCount ? 1 : 0);
}
开发者ID:chamdoo,项目名称:xbsv,代码行数:58,代码来源:testmemread.cpp

示例2: main

int main(int argc, const char **argv)
{
  unsigned int srcGen = 0;

  Memread2RequestProxy *device = 0;
  Memread2Indication *deviceIndication = 0;

  fprintf(stderr, "Main::%s %s\n", __DATE__, __TIME__);

  device = new Memread2RequestProxy(IfcNames_Memread2Request);
  DmaDebugRequestProxy *hostDmaDebugRequest = new DmaDebugRequestProxy(IfcNames_HostDmaDebugRequest);
  MMUConfigRequestProxy *dmap = new MMUConfigRequestProxy(IfcNames_HostMMUConfigRequest);
  DmaManager *dma = new DmaManager(hostDmaDebugRequest, dmap);
  DmaDebugIndication *hostDmaDebugIndication = new DmaDebugIndication(dma, IfcNames_HostDmaDebugIndication);
  MMUConfigIndication *hostMMUConfigIndication = new MMUConfigIndication(dma, IfcNames_HostMMUConfigIndication);

  deviceIndication = new Memread2Indication(IfcNames_Memread2Indication);

  fprintf(stderr, "Main::allocating memory...\n");
  srcAlloc = portalAlloc(alloc_sz);
  srcBuffer = (unsigned int *)portalMmap(srcAlloc, alloc_sz);
  srcAlloc2 = portalAlloc(alloc_sz);
  srcBuffer2 = (unsigned int *)portalMmap(srcAlloc2, alloc_sz);

  portalExec_start();

  for (int i = 0; i < numWords; i++){
    int v = srcGen++;
    srcBuffer[i] = v;
    srcBuffer2[i] = v*3;
  }
    
  portalDCacheFlushInval(srcAlloc, alloc_sz, srcBuffer);
  fprintf(stderr, "Main::flush and invalidate complete\n");

  unsigned int ref_srcAlloc = dma->reference(srcAlloc);
  fprintf(stderr, "ref_srcAlloc=%d\n", ref_srcAlloc);
  unsigned int ref_srcAlloc2 = dma->reference(srcAlloc2);
  fprintf(stderr, "ref_srcAlloc2=%d\n", ref_srcAlloc2);

  fprintf(stderr, "Main::starting read %08x\n", numWords);
  device->startRead(ref_srcAlloc, ref_srcAlloc2, 32, 16);
  fprintf(stderr, "Main::sleeping\n");
  while(true){
    sleep(3);
    device->getStateDbg();
    uint64_t beats = dma->show_mem_stats(ChannelType_Read);
    fprintf(stderr, "   beats: %"PRIx64"\n", beats);
    hostDmaDebugRequest->getStateDbg(ChannelType_Read);
  }
}
开发者ID:hejin,项目名称:xbsv,代码行数:51,代码来源:testmemread2.cpp

示例3: main


//.........这里部分代码省略.........
    uint16_t swFetch[fetch_len];

    init_timer();
    start_timer(0);


    fprintf(stderr, "elapsed time (hw cycles): %zd\n", lap_timer(0));
    
    dma->dCacheFlushInval(strAAlloc, strA);
    dma->dCacheFlushInval(strBAlloc, strB);
    dma->dCacheFlushInval(fetchAlloc, fetch);

    unsigned int ref_strAAlloc = dma->reference(strAAlloc);
    unsigned int ref_strBAlloc = dma->reference(strBAlloc);
    unsigned int ref_fetchAlloc = dma->reference(fetchAlloc);

    device->setupA(ref_strAAlloc, 0, strA_len);
    sem_wait(&test_sem);

    device->setupB(ref_strBAlloc, 0, strB_len);
    sem_wait(&test_sem);

    uint64_t cycles;
    uint64_t beats;

    fprintf(stderr, "starting algorithm A\n");

    init_timer();
    start_timer(0);

    device->start(0);
    sem_wait(&test_sem);
    cycles = lap_timer(0);
    beats = dma->show_mem_stats(ChannelType_Read);
    fprintf(stderr, "hw cycles: %f\n", (float)cycles);
    device->fetch(ref_fetchAlloc, 0, 0, fetch_len / 2);
    sem_wait(&test_sem);
    printf("fetch 1 finished \n");
    device->fetch(ref_fetchAlloc, fetch_len, fetch_len / 2, fetch_len / 2);
    sem_wait(&test_sem);
    printf("fetch 2 finished \n");

    memcpy(swFetch, fetch, fetch_len * sizeof(uint16_t));
    printf("        ");
    for (int j = 0; j <= strB_len; j += 1) {
      printf("%4d", j);
    }
    printf("\n");
    printf("        ");
    for (int j = 0; j <= strB_len; j += 1) {
      printf("%4c", strB[j-1]);
    }
    printf("\n");
    for (int i = 0; i <= strA_len; i += 1) {
      printf("%4c%4d", strA[i-1], i);
      for (int j = 0; j <= strB_len; j += 1) {
	printf("%4d", swFetch[(i << 7) + j] & 0xff);
      }
    printf("\n");
    }


    fprintf(stderr, "starting algorithm B, forward\n");
    init_timer();
    start_timer(0);
开发者ID:suhaspai,项目名称:xbsv,代码行数:66,代码来源:testmaxcommonsubseq.cpp


注:本文中的DmaManager::show_mem_stats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。