MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / requestDiskByteUsage

Method requestDiskByteUsage

tensorflow/core/debug/debug_io_utils.cc:698–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

696mutex DebugFileIO::bytes_mu_(LINKER_INITIALIZED);
697
698bool DebugFileIO::requestDiskByteUsage(uint64 bytes) {
699 mutex_lock l(bytes_mu_);
700 if (global_disk_bytes_limit_ == 0) {
701 const char* env_tfdbg_disk_bytes_limit = getenv("TFDBG_DISK_BYTES_LIMIT");
702 if (env_tfdbg_disk_bytes_limit == nullptr ||
703 strlen(env_tfdbg_disk_bytes_limit) == 0) {
704 global_disk_bytes_limit_ = kDefaultGlobalDiskBytesLimit;
705 } else {
706 strings::safe_strtou64(string(env_tfdbg_disk_bytes_limit),
707 &global_disk_bytes_limit_);
708 }
709 }
710
711 if (bytes == 0) {
712 return true;
713 }
714 if (disk_bytes_used_ + bytes < global_disk_bytes_limit_) {
715 disk_bytes_used_ += bytes;
716 return true;
717 } else {
718 return false;
719 }
720}
721
722void DebugFileIO::resetDiskByteUsage() {
723 mutex_lock l(bytes_mu_);

Callers

nothing calls this directly

Calls 1

safe_strtou64Function · 0.85

Tested by

no test coverage detected