diff options
author | 2017-01-18 16:06:18 -0800 | |
---|---|---|
committer | 2017-01-18 16:25:54 -0800 | |
commit | d2eb7da54fe89f30c4017649405279d02eeb24d9 (patch) | |
tree | dfde1017dba3ce361666a0626edafc5a21774ed3 /tensorflow/core/platform/profile_utils/cpu_utils_test.cc | |
parent | 2e8effc2c0258dbaa96dfeb9c27a08b3227654b3 (diff) |
Add a utility class for clock cycle profiling and use it in soc graph execution test
Change: 144895232
Diffstat (limited to 'tensorflow/core/platform/profile_utils/cpu_utils_test.cc')
-rw-r--r-- | tensorflow/core/platform/profile_utils/cpu_utils_test.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tensorflow/core/platform/profile_utils/cpu_utils_test.cc b/tensorflow/core/platform/profile_utils/cpu_utils_test.cc index 7cbd994661..fccc4d38a7 100644 --- a/tensorflow/core/platform/profile_utils/cpu_utils_test.cc +++ b/tensorflow/core/platform/profile_utils/cpu_utils_test.cc @@ -16,6 +16,7 @@ limitations under the License. #include "tensorflow/core/platform/profile_utils/cpu_utils.h" #include "tensorflow/core/platform/logging.h" +#include "tensorflow/core/platform/profile_utils/clock_cycle_profiler.h" #include "tensorflow/core/platform/test.h" namespace tensorflow { @@ -68,5 +69,18 @@ TEST_F(CpuUtilsTest, CheckMicroSecPerClock) { } } +TEST_F(CpuUtilsTest, SimpleUsageOfClockCycleProfiler) { + static constexpr int LOOP_COUNT = 10; + ClockCycleProfiler prof; + for (int i = 0; i < LOOP_COUNT; ++i) { + prof.Start(); + prof.Stop(); + } + EXPECT_EQ(LOOP_COUNT, static_cast<int>(prof.GetCount() + 0.5)); + if (DBG) { + prof.DumpStatistics("CpuUtilsTest"); + } +} + } // namespace profile_utils } // namespace tensorflow |