| 69 | } |
| 70 | |
| 71 | bool TFShow::ShouldShow(const ShowNode* node, const Options& opts, |
| 72 | int depth) const { |
| 73 | // Always show kTFProfRoot. |
| 74 | if (node->name() == kTFProfRoot) return true; |
| 75 | |
| 76 | if (node->proto().total_requested_bytes() < opts.min_bytes || |
| 77 | node->proto().total_peak_bytes() < opts.min_peak_bytes || |
| 78 | node->proto().total_residual_bytes() < opts.min_residual_bytes || |
| 79 | node->proto().total_output_bytes() < opts.min_output_bytes || |
| 80 | node->proto().total_exec_micros() < opts.min_micros || |
| 81 | node->proto().total_accelerator_exec_micros() < |
| 82 | opts.min_accelerator_micros || |
| 83 | node->proto().total_cpu_exec_micros() < opts.min_cpu_micros || |
| 84 | node->proto().parameters() < opts.min_params || |
| 85 | node->proto().float_ops() < opts.min_float_ops || |
| 86 | node->proto().run_count() < opts.min_occurrence || |
| 87 | depth > opts.max_depth || !ShouldShowIfExtra(node, opts, depth)) { |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | bool show = false; |
| 92 | if (opts.show_name_regexes.size() == 1 && opts.show_name_regexes[0] == ".*") { |
| 93 | show = true; |
| 94 | } else { |
| 95 | for (const string& regex : opts.show_name_regexes) { |
| 96 | if (RE2::FullMatch(node->name(), regex)) { |
| 97 | show = true; |
| 98 | break; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | // Don't show if show_name_regexes don't cover it. |
| 103 | if (!show) return false; |
| 104 | // Don't show if hide_name_regexes cover it. |
| 105 | for (const string& regex : opts.hide_name_regexes) { |
| 106 | if (RE2::FullMatch(node->name(), regex)) return false; |
| 107 | } |
| 108 | return true; |
| 109 | } |
| 110 | |
| 111 | bool TFShow::ShouldTrim(const ShowNode* node, |
| 112 | const std::vector<string>& regexes) const { |