* @return bool True if set, false if not (also returns true on error)
*/
final public function check( $domain, $type, $member ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
if ( method_exists( "BloomFilter{$type}", 'mergeAndCheck' ) ) {
try {
* @return bool Success
*/
final public function insert( $domain, $type, $members ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
if ( method_exists( "BloomFilter{$type}", 'mergeAndCheck' ) ) {
try {
* @return bool Success
*/
final public function init( $key, $size = 1000000, $precision = .001 ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
return $this->doInit( "{$this->cacheID}:$key", $size, min( .1, $precision ) );
}
* @return bool Success
*/
final public function add( $key, $members ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
return $this->doAdd( "{$this->cacheID}:$key", (array)$members );
}
* @return bool|null True if set, false if not, null on error
*/
final public function isHit( $key, $member ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
return $this->doIsHit( "{$this->cacheID}:$key", $member );
}
* @return bool Success
*/
final public function delete( $key ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
return $this->doDelete( "{$this->cacheID}:$key" );
}
* @return bool Success
*/
final public function setStatus( $virtualKey, array $values ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
return $this->doSetStatus( "{$this->cacheID}:$virtualKey", $values );
}
* @return array|bool False on failure
*/
final public function getStatus( $virtualKey ) {
- $section = new ProfileSection( get_class( $this ) . '::' . __FUNCTION__ );
+ $ps = Profiler::instance()->scopedProfileIn( get_class( $this ) . '::' . __FUNCTION__ );
return $this->doGetStatus( "{$this->cacheID}:$virtualKey" );
}
* @return Status
*/
final public function createInternal( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
if ( strlen( $params['content'] ) > $this->maxFileSizeInternal() ) {
$status = Status::newFatal( 'backend-fail-maxsize',
$params['dst'], $this->maxFileSizeInternal() );
* @return Status
*/
final public function storeInternal( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
if ( filesize( $params['src'] ) > $this->maxFileSizeInternal() ) {
$status = Status::newFatal( 'backend-fail-maxsize',
$params['dst'], $this->maxFileSizeInternal() );
* @return Status
*/
final public function copyInternal( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = $this->doCopyInternal( $params );
$this->clearCache( array( $params['dst'] ) );
if ( !isset( $params['dstExists'] ) || $params['dstExists'] ) {
* @return Status
*/
final public function deleteInternal( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = $this->doDeleteInternal( $params );
$this->clearCache( array( $params['src'] ) );
$this->deleteFileCache( $params['src'] ); // persistent cache
* @return Status
*/
final public function moveInternal( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = $this->doMoveInternal( $params );
$this->clearCache( array( $params['src'], $params['dst'] ) );
$this->deleteFileCache( $params['src'] ); // persistent cache
* @return Status
*/
final public function describeInternal( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
if ( count( $params['headers'] ) ) {
$status = $this->doDescribeInternal( $params );
$this->clearCache( array( $params['src'] ) );
}
final public function concatenate( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
// Try to lock the source files for the scope of this function
}
final protected function doPrepare( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] );
}
final protected function doSecure( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] );
}
final protected function doPublish( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] );
}
final protected function doClean( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
// Recursive: first delete all empty subdirs recursively
}
final public function fileExists( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$stat = $this->getFileStat( $params );
return ( $stat === null ) ? null : (bool)$stat; // null => failure
}
final public function getFileTimestamp( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$stat = $this->getFileStat( $params );
return $stat ? $stat['mtime'] : false;
}
final public function getFileSize( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$stat = $this->getFileStat( $params );
return $stat ? $stat['size'] : false;
if ( $path === null ) {
return false; // invalid storage path
}
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$latest = !empty( $params['latest'] ); // use latest data?
if ( !$this->cheapCache->has( $path, 'stat', self::CACHE_TTL ) ) {
$this->primeFileCache( array( $path ) ); // check persistent cache
abstract protected function doGetFileStat( array $params );
public function getFileContentsMulti( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$params = $this->setConcurrencyFlags( $params );
$contents = $this->doGetFileContentsMulti( $params );
if ( $path === null ) {
return false; // invalid storage path
}
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$latest = !empty( $params['latest'] ); // use latest data?
if ( $this->cheapCache->has( $path, 'xattr', self::CACHE_TTL ) ) {
$stat = $this->cheapCache->get( $path, 'xattr' );
if ( $path === null ) {
return false; // invalid storage path
}
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$latest = !empty( $params['latest'] ); // use latest data?
if ( $this->cheapCache->has( $path, 'sha1', self::CACHE_TTL ) ) {
$stat = $this->cheapCache->get( $path, 'sha1' );
}
final public function getFileProps( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$fsFile = $this->getLocalReference( $params );
$props = $fsFile ? $fsFile->getProps() : FSFile::placeholderProps();
}
final public function getLocalReferenceMulti( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$params = $this->setConcurrencyFlags( $params );
}
final public function getLocalCopyMulti( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$params = $this->setConcurrencyFlags( $params );
$tmpFiles = $this->doGetLocalCopyMulti( $params );
}
final public function streamFile( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
$info = $this->getFileStat( $params );
}
final protected function doOperationsInternal( array $ops, array $opts ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
// Fix up custom header name/value pairs...
}
final protected function doQuickOperationsInternal( array $ops ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$status = Status::newGood();
// Fix up custom header name/value pairs...
* @return array Map of Status objects
*/
final public function executeOpHandlesInternal( array $fileOpHandles ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
foreach ( $fileOpHandles as $fileOpHandle ) {
if ( !( $fileOpHandle instanceof FileBackendStoreOpHandle ) ) {
}
final public function preloadFileStat( array $params ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$success = true; // no network errors
$params['concurrency'] = ( $this->parallelize !== 'off' ) ? $this->concurrency : 1;
* @param array $items
*/
final protected function primeContainerCache( array $items ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$paths = array(); // list of storage paths
$contNames = array(); // (cache key => resolved container name)
* @param array $items List of storage paths
*/
final protected function primeFileCache( array $items ) {
- $section = new ProfileSection( __METHOD__ . "-{$this->name}" );
+ $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
$paths = array(); // list of storage paths
$pathNames = array(); // (cache key => storage path)