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


C++ MemoryUsage函数代码示例

本文整理汇总了C++中MemoryUsage函数的典型用法代码示例。如果您正苦于以下问题:C++ MemoryUsage函数的具体用法?C++ MemoryUsage怎么用?C++ MemoryUsage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: LOG

nsresult
CacheFileMetadata::SetHash(uint32_t aIndex, CacheHash::Hash16_t aHash)
{
  LOG(("CacheFileMetadata::SetHash() [this=%p, idx=%d, hash=%x]",
       this, aIndex, aHash));

  MarkDirty();

  MOZ_ASSERT(aIndex <= mHashCount);

  if (aIndex > mHashCount) {
    return NS_ERROR_INVALID_ARG;
  } else if (aIndex == mHashCount) {
    if ((aIndex + 1) * sizeof(CacheHash::Hash16_t) > mHashArraySize) {
      // reallocate hash array buffer
      if (mHashArraySize == 0)
        mHashArraySize = 32 * sizeof(CacheHash::Hash16_t);
      else
        mHashArraySize *= 2;
      mHashArray = static_cast<CacheHash::Hash16_t *>(
                     moz_xrealloc(mHashArray, mHashArraySize));
    }

    mHashCount++;
  }

  NetworkEndian::writeUint16(&mHashArray[aIndex], aHash);

  DoMemoryReport(MemoryUsage());

  return NS_OK;
}
开发者ID:franzks,项目名称:gecko-dev,代码行数:32,代码来源:CacheFileMetadata.cpp

示例2: sizeof

char* Arena::AllocateNewBlock(size_t block_bytes) {
  char* result = new char[block_bytes];
  blocks_.push_back(result);
  memory_usage_.NoBarrier_Store(
      reinterpret_cast<void*>(MemoryUsage() + block_bytes + sizeof(char*)));
  return result;
}
开发者ID:yanxi10,项目名称:leveldblib,代码行数:7,代码来源:arena.cpp

示例3: used_in_bytes

MemoryUsage CodeHeapPool::get_memory_usage() {
  size_t used      = used_in_bytes();
  size_t committed = _codeHeap->capacity();
  size_t maxSize   = (available_for_allocation() ? max_size() : 0);

  return MemoryUsage(initial_size(), used, committed, maxSize);
}
开发者ID:guanxiaohua,项目名称:TransGC,代码行数:7,代码来源:memoryPool.cpp

示例4: max_size

MemoryUsage EdenMutableSpacePool::get_memory_usage() {
  size_t maxSize   = (available_for_allocation() ? max_size() : 0);
  size_t used = used_in_bytes();
  size_t committed = _space->capacity_in_bytes();

  return MemoryUsage(initial_size(), used, committed, maxSize);
}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:7,代码来源:psMemoryPool.cpp

示例5: max_size

MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() {
  size_t maxSize = (available_for_allocation() ? max_size() : 0);
  size_t used    = used_in_bytes();
  size_t committed = committed_in_bytes();

  return MemoryUsage(initial_size(), used, committed, maxSize);
}
开发者ID:guanxiaohua,项目名称:TransGC,代码行数:7,代码来源:memoryPool.cpp

示例6: max_size

MemoryUsage PSGenerationPool::get_memory_usage() {
  size_t maxSize   = (available_for_allocation() ? max_size() : 0);
  size_t used      = used_in_bytes();
  size_t committed = _old_gen->capacity_in_bytes();

  return MemoryUsage(initial_size(), used, committed, maxSize);
}
开发者ID:campolake,项目名称:openjdk9,代码行数:7,代码来源:psMemoryPool.cpp

示例7: initial_size

MemoryUsage G1OldGenPool::get_memory_usage() {
  size_t initial_sz = initial_size();
  size_t max_sz     = max_size();
  size_t used       = used_in_bytes();
  size_t committed  = _g1mm->old_space_committed();

  return MemoryUsage(initial_sz, used, committed, max_sz);
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:8,代码来源:g1MemoryPool.cpp

示例8: DoMemoryReport

void
CacheFileMetadata::EnsureBuffer(uint32_t aSize)
{
  if (mBufSize < aSize) {
    mBufSize = aSize;
    mBuf = static_cast<char *>(moz_xrealloc(mBuf, mBufSize));
  }

  DoMemoryReport(MemoryUsage());
}
开发者ID:franzks,项目名称:gecko-dev,代码行数:10,代码来源:CacheFileMetadata.cpp

示例9: get_memory_usage

void MemoryPool::record_peak_memory_usage() {
  // Caller in JDK is responsible for synchronization -
  // acquire the lock for this memory pool before calling VM
  MemoryUsage usage = get_memory_usage();
  size_t peak_used = get_max_value(usage.used(), _peak_usage.used());
  size_t peak_committed = get_max_value(usage.committed(), _peak_usage.committed());
  size_t peak_max_size = get_max_value(usage.max_size(), _peak_usage.max_size());

  _peak_usage = MemoryUsage(initial_size(), peak_used, peak_committed, peak_max_size);
}
开发者ID:guanxiaohua,项目名称:TransGC,代码行数:10,代码来源:memoryPool.cpp

示例10: ieRefCount

ieImage::ieImage(ieWH wh_, iePixelFormat pf_)
:	ieRefCount(), 
	wh(wh_), 
	pf(pf_),
	at(ieAlphaType::None), 
	Frame() 
{
#ifdef _DEBUG
	nInstances++;
	nMemoryUsage += MemoryUsage();
#endif
}
开发者ID:FMJ-Software,项目名称:ieCpp,代码行数:12,代码来源:ieImage.cpp

示例11: MemoryUsage

/** 
 * Testing function 
 * return true if there is no errors
 * return false if there are and the descriptions in strerr
 */
bool TestGraph::TestAll()
{
	char* unit; 	
	float size = MemoryUsage();
	if( size < 1024 )
		unit = "KB";
	else
	{
		size /= 1024;
		unit = "MB";
	}	
	printf("Graph used %.1f%s of RAM.\n", size, unit);
	return true;
}
开发者ID:AIDman,项目名称:Kaldi,代码行数:19,代码来源:test_graph.cpp

示例12: MemoryUsage

MemoryUsage HeapRegionManager::get_auxiliary_data_memory_usage() const {
  size_t used_sz =
    _prev_bitmap_mapper->committed_size() +
    _next_bitmap_mapper->committed_size() +
    _bot_mapper->committed_size() +
    _cardtable_mapper->committed_size() +
    _card_counts_mapper->committed_size();

  size_t committed_sz =
    _prev_bitmap_mapper->reserved_size() +
    _next_bitmap_mapper->reserved_size() +
    _bot_mapper->reserved_size() +
    _cardtable_mapper->reserved_size() +
    _card_counts_mapper->reserved_size();

  return MemoryUsage(0, used_sz, committed_sz, committed_sz);
}
开发者ID:campolake,项目名称:openjdk9,代码行数:17,代码来源:heapRegionManager.cpp

示例13: MemoryUsage

ieImage::~ieImage()
{
	if (Frame.pimNext) {
		Frame.pimNext->FrameParams().pimPrev = nullptr;
		Frame.pimNext->Release();
	}
	if (Frame.pimPrev) {
		Frame.pimPrev->FrameParams().pimNext = nullptr;
		Frame.pimPrev->Release();
	}
	if (Frame.pimRest) {
		Frame.pimRest->Release();
	}
#ifdef _DEBUG
	nInstances--;
	nMemoryUsage -= MemoryUsage();
#endif
}
开发者ID:FMJ-Software,项目名称:ieCpp,代码行数:18,代码来源:ieImage.cpp

示例14: free

void
CacheFileMetadata::InitEmptyMetadata()
{
  if (mBuf) {
    free(mBuf);
    mBuf = nullptr;
    mBufSize = 0;
  }
  mOffset = 0;
  mMetaHdr.mVersion = kCacheEntryVersion;
  mMetaHdr.mFetchCount = 0;
  mMetaHdr.mExpirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
  mMetaHdr.mKeySize = mKey.Length();

  DoMemoryReport(MemoryUsage());

  // We're creating a new entry. If there is any old data truncate it.
  if (mHandle && mHandle->FileExists() && mHandle->FileSize()) {
    CacheFileIOManager::TruncateSeekSetEOF(mHandle, 0, 0, nullptr);
  }
}
开发者ID:logicoftekk,项目名称:cyberfox,代码行数:21,代码来源:CacheFileMetadata.cpp

示例15: DoMemoryReport

nsresult
CacheFileMetadata::EnsureBuffer(uint32_t aSize)
{
  if (aSize > kMaxElementsSize) {
    return NS_ERROR_FAILURE;
  }

  if (mBufSize < aSize) {
    if (mAllocExactSize) {
      // If this is not the only allocation, use power of two for following
      // allocations.
      mAllocExactSize = false;
    } else {
      // find smallest power of 2 greater than or equal to aSize
      --aSize;
      aSize |= aSize >> 1;
      aSize |= aSize >> 2;
      aSize |= aSize >> 4;
      aSize |= aSize >> 8;
      aSize |= aSize >> 16;
      ++aSize;
    }

    if (aSize < kInitialBufSize) {
      aSize = kInitialBufSize;
    }

    char *newBuf = static_cast<char *>(realloc(mBuf, aSize));
    if (!newBuf) {
      return NS_ERROR_OUT_OF_MEMORY;
    }
    mBufSize = aSize;
    mBuf = newBuf;

    DoMemoryReport(MemoryUsage());
  }

  return NS_OK;
}
开发者ID:logicoftekk,项目名称:cyberfox,代码行数:39,代码来源:CacheFileMetadata.cpp


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