• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MemoryUsage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: MemoryUsage

MemoryPool::MemoryPool(const char* name,
                       PoolType type,
                       size_t init_size,
                       size_t max_size,
                       bool support_usage_threshold,
                       bool support_gc_threshold) {
  _name = name;
  _initial_size = init_size;
  _max_size = max_size;
  _memory_pool_obj = NULL;
  _available_for_allocation = true;
  _num_managers = 0;
  _type = type;

  // initialize the max and init size of collection usage
  _after_gc_usage = MemoryUsage(_initial_size, 0, 0, _max_size);

  _usage_sensor = NULL;
  _gc_usage_sensor = NULL;
  // usage threshold supports both high and low threshold
  _usage_threshold = new ThresholdSupport(support_usage_threshold, support_usage_threshold);
  // gc usage threshold supports only high threshold
  _gc_usage_threshold = new ThresholdSupport(support_gc_threshold, support_gc_threshold);
}
开发者ID:guanxiaohua,项目名称:TransGC,代码行数:24,代码来源:memoryPool.cpp


示例17: setTree


//.........这里部分代码省略.........
						if(cIndex&2) myCenter[1] += myWidth/2;
						else		 myCenter[1] -= myWidth/2;
						if(cIndex&4) myCenter[2] += myWidth/2;
						else		 myCenter[2] -= myWidth/2;
						d++;
					}
					SplatOrientedPoint( temp , p , n , neighborKey );
				}
				pointWeightSum += pointWeight;
				if ( this->_constrainValues )
				{
					int d = 0;
					TreeOctNode* temp = &this->tree;
					Point3D< Real > myCenter = Point3D< Real >( Real(0.5) , Real(0.5) , Real(0.5) );
					Real myWidth = Real(1.0);
					while( true )
					{
						int idx = temp->nodeData.pointIndex;
						if( idx == -1 )
						{
							idx = static_cast<int>( this->_points.size() );
							this->_points.push_back( PointData( p , Real(1.0) ) );
							temp->nodeData.pointIndex = idx;
						}
						else
						{
							this->_points[idx].weight += Real(1.0);
							this->_points[idx].position += p;
						}

						int cIndex = TreeOctNode::CornerIndex( myCenter , p );
						if ( !temp->children )
							break;
						
						temp = &temp->children[cIndex];
						myWidth /= 2;
						if( cIndex&1 ) myCenter[0] += myWidth/2;
						else		   myCenter[0] -= myWidth/2;
						if( cIndex&2 ) myCenter[1] += myWidth/2;
						else		   myCenter[1] -= myWidth/2;
						if( cIndex&4 ) myCenter[2] += myWidth/2;
						else		   myCenter[2] -= myWidth/2;
						d++;
					}
				}

				++cnt;
			}
		}

		if( this->_boundaryType == 0 )
			pointWeightSum *= Real(4.0);
		
		constraintWeight *= static_cast<Real>(pointWeightSum);
		constraintWeight /= static_cast<Real>(cnt);

		MemoryUsage( );

		if( this->_constrainValues )
		{
			for( TreeOctNode* node=this->tree.nextNode() ; node ; node=this->tree.nextNode(node) )
			{
				if( node->nodeData.pointIndex != -1 )
				{
					int idx = node->nodeData.pointIndex;
					this->_points[idx].position /= this->_points[idx].weight;
					int e = ( this->_boundaryType == 0 ? node->depth()-1 : node->depth() ) * adaptiveExponent - ( this->_boundaryType == 0 ? maxDepth-1 : maxDepth ) * (adaptiveExponent-1);
					
					if ( e < 0 )
						this->_points[idx].weight /= Real( 1<<(-e) );
					else
						this->_points[idx].weight *= Real( 1<<  e  );

					this->_points[idx].weight *= Real( constraintWeight );
				}
			}
		}

#if FORCE_NEUMANN_FIELD
		if( this->_boundaryType == 1 )
		{
			for( TreeOctNode* node=this->tree.nextNode() ; node ; node=this->tree.nextNode( node ) )
			{
				int d , off[3];
				node->depthAndOffset( d , off );
				int res = 1<<d;
				if( node->nodeData.normalIndex < 0 )
					continue;
				
				Point3D< Real >& normal = (*this->normals)[node->nodeData.normalIndex];
				for( int d=0 ; d<3 ; d++ )
					if ( off[d]==0 || off[d]==res-1 )
						normal[d] = 0;
			}
		}
#endif // FORCE_NEUMANN_FIELD

		MemoryUsage();
		return cnt;
	}
开发者ID:Aerochip7,项目名称:trunk,代码行数:101,代码来源:PoissonReconLib.cpp


示例18: LOG

nsresult
CacheFileMetadata::WriteMetadata(uint32_t aOffset,
                                 CacheFileMetadataListener *aListener)
{
  LOG(("CacheFileMetadata::WriteMetadata() [this=%p, offset=%d, listener=%p]",
       this, aOffset, aListener));

  MOZ_ASSERT(!mListener);
  MOZ_ASSERT(!mWriteBuf);

  nsresult rv;

  mIsDirty = false;

  mWriteBuf = static_cast<char *>(malloc(CalcMetadataSize(mElementsSize,
                                                          mHashCount)));
  if (!mWriteBuf) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  char *p = mWriteBuf + sizeof(uint32_t);
  memcpy(p, mHashArray, mHashCount * sizeof(CacheHash::Hash16_t));
  p += mHashCount * sizeof(CacheHash::Hash16_t);
  mMetaHdr.WriteToBuf(p);
  p += sizeof(CacheFileMetadataHeader);
  memcpy(p, mKey.get(), mKey.Length());
  p += mKey.Length();
  *p = 0;
  p++;
  memcpy(p, mBuf, mElementsSize);
  p += mElementsSize;

  CacheHash::Hash32_t hash;
  hash = CacheHash::Hash(mWriteBuf + sizeof(uint32_t),
                         p - mWriteBuf - sizeof(uint32_t));
  NetworkEndian::writeUint32(mWriteBuf, hash);

  NetworkEndian::writeUint32(p, aOffset);
  p += sizeof(uint32_t);

  char * writeBuffer = mWriteBuf;
  if (aListener) {
    mListener = aListener;
  } else {
    // We are not going to pass |this| as a callback so the buffer will be
    // released by CacheFileIOManager. Just null out mWriteBuf here.
    mWriteBuf = nullptr;
  }

  rv = CacheFileIOManager::Write(mHandle, aOffset, writeBuffer, p - writeBuffer,
                                 true, true, aListener ? this : nullptr);
  if (NS_FAILED(rv)) {
    LOG(("CacheFileMetadata::WriteMetadata() - CacheFileIOManager::Write() "
         "failed synchronously. [this=%p, rv=0x%08x]", this, rv));

    mListener = nullptr;
    if (mWriteBuf) {
      free(mWriteBuf);
      mWriteBuf = nullptr;
    }
    NS_ENSURE_SUCCESS(rv, rv);
  }

  DoMemoryReport(MemoryUsage());

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Memory_Free函数代码示例发布时间:2022-05-30
下一篇:
C++ MemoryContextReset函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap