| 96 | }; |
| 97 | |
| 98 | TEST_F(TFProfShowTest, DumpScopeMode) { |
| 99 | string dump_file = io::JoinPath(testing::TmpDir(), "dump"); |
| 100 | Options opts( |
| 101 | 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, "name", |
| 102 | {"VariableV2"}, // accout_type_regexes |
| 103 | {".*"}, {""}, {".*"}, {""}, false, |
| 104 | {"params", "bytes", "peak_bytes", "residual_bytes", "output_bytes", |
| 105 | "micros", "accelerator_micros", "cpu_micros", "float_ops"}, |
| 106 | "file", {{"outfile", dump_file}}); |
| 107 | tf_stats_->ShowGraphNode("scope", opts); |
| 108 | |
| 109 | string dump_str; |
| 110 | TF_CHECK_OK(ReadFileToString(Env::Default(), dump_file, &dump_str)); |
| 111 | EXPECT_EQ( |
| 112 | "node name | # parameters | # float_ops | requested bytes | peak bytes | " |
| 113 | "residual bytes | output bytes | total execution time | accelerator " |
| 114 | "execution time | cpu execution time\n_TFProfRoot (--/451 params, --/0 " |
| 115 | "flops, --/2.56KB, --/2.56KB, --/2.56KB, --/2.56KB, --/13us, --/0us, " |
| 116 | "--/13us)\n DW (3x3x3x6, 162/162 params, 0/0 flops, 1.28KB/1.28KB, " |
| 117 | "1.28KB/1.28KB, 1.28KB/1.28KB, 1.28KB/1.28KB, 2us/2us, 0us/0us, " |
| 118 | "2us/2us)\n DW2 (2x2x6x12, 288/288 params, 0/0 flops, 1.28KB/1.28KB, " |
| 119 | "1.28KB/1.28KB, 1.28KB/1.28KB, 1.28KB/1.28KB, 11us/11us, 0us/0us, " |
| 120 | "11us/11us)\n ScalarW (1, 1/1 params, 0/0 flops, 0B/0B, 0B/0B, 0B/0B, " |
| 121 | "0B/0B, 0us/0us, 0us/0us, 0us/0us)\n", |
| 122 | CheckAndRemoveDoc(dump_str)); |
| 123 | |
| 124 | EXPECT_EQ(dump_str, TestToFromProto("scope", opts)); |
| 125 | } |
| 126 | |
| 127 | TEST_F(TFProfShowTest, DumpAcceleratorAndCPUMicros) { |
| 128 | string dump_file = io::JoinPath(testing::TmpDir(), "dump"); |
nothing calls this directly
no test coverage detected