Add space for reporting memory bandwidth statistics
PiperOrigin-RevId: 356439798 Change-Id: Ifd17237136c02e68b2d432a12409c4d467d22c8c
This commit is contained in:
parent
792639b6e6
commit
d5a6c5259d
@ -463,7 +463,6 @@ tf_kernel_library(
|
||||
"//tensorflow/core:session_options",
|
||||
"//tensorflow/core/kernels:ops_util",
|
||||
"//tensorflow/core/profiler/lib:traceme",
|
||||
"//tensorflow/core/profiler/lib:traceme_encode",
|
||||
"@com_google_absl//absl/memory",
|
||||
],
|
||||
)
|
||||
|
@ -47,12 +47,10 @@ limitations under the License.
|
||||
#include "tensorflow/core/lib/strings/stringprintf.h"
|
||||
#include "tensorflow/core/platform/casts.h"
|
||||
#include "tensorflow/core/platform/env.h"
|
||||
#include "tensorflow/core/platform/mem.h"
|
||||
#include "tensorflow/core/platform/mutex.h"
|
||||
#include "tensorflow/core/platform/refcount.h"
|
||||
#include "tensorflow/core/platform/resource.h"
|
||||
#include "tensorflow/core/profiler/lib/traceme.h"
|
||||
#include "tensorflow/core/profiler/lib/traceme_encode.h"
|
||||
#include "tensorflow/core/public/session_options.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -967,18 +965,9 @@ void RecordElementSize(const std::vector<Tensor> element,
|
||||
Status IteratorGetNextOp::DoCompute(OpKernelContext* ctx) {
|
||||
profiler::TraceMe traceme(
|
||||
[&] {
|
||||
int64 mem_bw = port::GetMemoryInfo().bw_used;
|
||||
|
||||
if (mem_bw != INT64_MAX) {
|
||||
return profiler::TraceMeEncode(
|
||||
"IteratorGetNextOp::DoCompute",
|
||||
{{"id", ctx->step_id()},
|
||||
{"iter_num", ctx->frame_iter().iter_id},
|
||||
{"mem_bw_used_megabytes_per_sec", mem_bw}});
|
||||
}
|
||||
return profiler::TraceMeEncode(
|
||||
"IteratorGetNextOp::DoCompute",
|
||||
{{"id", ctx->step_id()}, {"iter_num", ctx->frame_iter().iter_id}});
|
||||
return strings::StrCat(
|
||||
"IteratorGetNextOp::DoCompute#id=", ctx->step_id(),
|
||||
",iter_num=", ctx->frame_iter().iter_id, "#");
|
||||
},
|
||||
profiler::kInfo);
|
||||
tensorflow::ResourceTagger tag(kTFDataResourceTag,
|
||||
|
@ -357,7 +357,7 @@ double NominalCPUFrequency() {
|
||||
}
|
||||
|
||||
MemoryInfo GetMemoryInfo() {
|
||||
MemoryInfo mem_info = {INT64_MAX, INT64_MAX, INT64_MAX};
|
||||
MemoryInfo mem_info = {INT64_MAX, INT64_MAX};
|
||||
#if defined(__linux__) && !defined(__ANDROID__)
|
||||
struct sysinfo info;
|
||||
int err = sysinfo(&info);
|
||||
|
@ -62,7 +62,6 @@ std::size_t MallocExtension_GetAllocatedSize(const void* p);
|
||||
struct MemoryInfo {
|
||||
int64 total = 0;
|
||||
int64 free = 0;
|
||||
int64 bw_used = 0; // memory bandwidth used across all CPU (in MBs/second)
|
||||
};
|
||||
|
||||
// Retrieves the host memory information. If any of the fields in the returned
|
||||
|
@ -192,7 +192,7 @@ double NominalCPUFrequency() {
|
||||
}
|
||||
|
||||
MemoryInfo GetMemoryInfo() {
|
||||
MemoryInfo mem_info = {INT64_MAX, INT64_MAX, INT64_MAX};
|
||||
MemoryInfo mem_info = {INT64_MAX, INT64_MAX};
|
||||
MEMORYSTATUSEX statex;
|
||||
statex.dwLength = sizeof(statex);
|
||||
if (GlobalMemoryStatusEx(&statex)) {
|
||||
|
Loading…
Reference in New Issue
Block a user