void tr_bandwidthUsed( tr_bandwidth * b, tr_direction dir, size_t byteCount, tr_bool isPieceData, uint64_t now ) { struct tr_band * band; assert( tr_isBandwidth( b ) ); assert( tr_isDirection( dir ) ); band = &b->band[dir]; if( band->isLimited && isPieceData ) band->bytesLeft -= MIN( band->bytesLeft, byteCount ); #ifdef DEBUG_DIRECTION if( ( dir == DEBUG_DIRECTION ) && ( band->isLimited ) ) fprintf( stderr, "%p consumed %5zu bytes of %5s data... was %6zu, now %6zu left\n", b, byteCount, (isPieceData?"piece":"raw"), oldBytesLeft, band->bytesLeft ); #endif bytesUsed( now, &band->raw, byteCount ); if( isPieceData ) bytesUsed( now, &band->piece, byteCount ); if( b->parent != NULL ) tr_bandwidthUsed( b->parent, dir, byteCount, isPieceData, now ); }
virtual ref<ArrayAbstract> clone() const { ref<Array> arr = new Array; if (size()) { arr->resize(size()); memcpy(arr->ptr(), ptr(), bytesUsed()); } return arr; }
uint64_t Namespace::bytesUsedDeep() const { uint64_t size = bytesUsed(); Atom prefix = getPrefix(); if (AvmCore::isString(prefix)) size += AvmCore::atomToString(prefix)->bytesUsed(); size += getURI()->bytesUsed(); return size; }
uint8_t* Buffer::getData(uint32_t& size) { uint8_t* pPtr = m_pReadPtr; size = std::min(bytesUsed(), size); if (m_pReadPtr + size >= m_pEnd) { size = static_cast<uint32_t>(m_pEnd - m_pReadPtr); m_pReadPtr = m_pAudioBuffer; } else { m_pReadPtr += size; } m_Fill -= size; return pPtr; }
//! Copies only the local data and not the VBO related fields void operator=(const ArrayAbstract& other) { gpuBuffer()->resize( other.gpuBuffer()->bytesUsed() ); memcpy( ptr(), other.ptr(), bytesUsed() ); setVBODirty(true); }
size_t size() const { return bytesUsed() / bytesPerVector(); }
int MemoryWatcher::bytesFree() const { return User::Heap().MaxLength() - bytesUsed(); }
int MemoryWatcher::usage() const { return 100 * bytesUsed() / User::Heap().MaxLength(); }