11// Copyright (C) 2018-2025 Intel Corporation
22// SPDX-License-Identifier: Apache-2.0
33//
4- #include < algorithm>
5- #include < cstdint>
6- #include < cstdio>
7- #include < cstring>
8- #include < utility>
9-
10- #include " dnnl_extension_utils.h"
11- #include " memory_desc/cpu_memory_desc.h"
12- #include " onednn/iml_type_mapper.h"
13- #include " utils/general_utils.h"
144#ifdef CPU_DEBUG_CAPS
5+ # include " common/verbose.hpp"
156
167# include < node.h>
178
9+ # include < algorithm>
10+ # include < cstdint>
11+ # include < cstdio>
1812# include < cstdlib>
13+ # include < cstring>
1914# include < iostream>
2015# include < sstream>
2116# include < string>
17+ # include < utility>
2218
2319# include " common/c_types_map.hpp"
24- # include " common/verbose.hpp"
2520# include " cpu_types.h"
21+ # include " dnnl_extension_utils.h"
22+ # include " memory_desc/cpu_memory_desc.h"
2623# include " memory_desc/cpu_memory_desc_utils.h"
24+ # include " onednn/iml_type_mapper.h"
25+ # include " utils/general_utils.h"
2726# include " verbose.h"
2827
2928namespace ov ::intel_cpu {
3029
3130bool Verbose::shouldBePrinted () const {
32- if (lvl < 1 ) {
31+ if (m_lvl < 1 ) {
3332 return false ;
3433 }
3534
36- if (lvl < 2 && any_of (node ->getType (), Type::Input, Type::Output)) {
35+ if (m_lvl < 2 && any_of (m_node ->getType (), Type::Input, Type::Output)) {
3736 return false ;
3837 }
3938
40- const bool low_level = lvl < 3 ;
41- const bool is_constant = node ->isConstant ();
39+ const bool low_level = m_lvl < 3 ;
40+ const bool is_constant = m_node ->isConstant ();
4241 const bool skip_node = low_level && is_constant;
4342 return !skip_node;
4443}
@@ -53,7 +52,7 @@ void Verbose::printInfo() {
5352 enum Color : uint8_t { RED, GREEN, YELLOW, BLUE, PURPLE, CYAN };
5453
5554 auto colorize = [&](const Color color, const std::string& str) {
56- if (!colorUp ) {
55+ if (!m_colorUp ) {
5756 return str;
5857 }
5958
@@ -146,22 +145,22 @@ void Verbose::printInfo() {
146145 shift (written);
147146 };
148147
149- for (size_t i = 0 ; i < node ->getParentEdges ().size (); i++) {
148+ for (size_t i = 0 ; i < m_node ->getParentEdges ().size (); i++) {
150149 std::string prefix (" src:" + std::to_string (i) + ' :' );
151- const auto & desc = node ->getParentEdgeAt (i)->getMemory ().getDescPtr ();
150+ const auto & desc = m_node ->getParentEdgeAt (i)->getMemory ().getDescPtr ();
152151 formatMemDesc (desc, prefix);
153152 }
154153
155- for (size_t i = 0 ; i < node ->getChildEdges ().size (); i++) {
154+ for (size_t i = 0 ; i < m_node ->getChildEdges ().size (); i++) {
156155 std::string prefix (" dst:" + std::to_string (i) + ' :' );
157- const auto & desc = node ->getChildEdgeAt (i)->getMemory ().getDescPtr ();
156+ const auto & desc = m_node ->getChildEdgeAt (i)->getMemory ().getDescPtr ();
158157 formatMemDesc (desc, prefix);
159158 }
160159
161160 std::string post_ops;
162- if (!node ->getFusedWith ().empty ()) {
161+ if (!m_node ->getFusedWith ().empty ()) {
163162 post_ops += " post_ops:'" ;
164- for (const auto & fusedNode : node ->getFusedWith ()) {
163+ for (const auto & fusedNode : m_node ->getFusedWith ()) {
165164 post_ops.append (colorize (GREEN, fusedNode->getName ()))
166165 .append (" :" )
167166 .append (colorize (CYAN, NameFromType (fusedNode->getType ())))
@@ -173,27 +172,27 @@ void Verbose::printInfo() {
173172 }
174173
175174 std::string nodeImplementer = " cpu" ;
176- if (node ->getType () == Type::Reference) {
175+ if (m_node ->getType () == Type::Reference) {
177176 nodeImplementer = " ngraph_ref" ; // ngraph reference
178177 }
179178
180- const std::string& nodeName = colorize (GREEN, node ->getName ());
181- const std::string& nodeType = colorize (CYAN, NameFromType (node ->getType ()));
182- const std::string& nodeAlg = algToString (node ->getAlgorithm ());
179+ const std::string& nodeName = colorize (GREEN, m_node ->getName ());
180+ const std::string& nodeType = colorize (CYAN, NameFromType (m_node ->getType ()));
181+ const std::string& nodeAlg = algToString (m_node ->getAlgorithm ());
183182 const std::string& nodePrimImplType =
184- impl_type_to_string (node ->getSelectedPrimitiveDescriptor ()->getImplementationType ());
183+ impl_type_to_string (m_node ->getSelectedPrimitiveDescriptor ()->getImplementationType ());
185184
186- stream << " ov_cpu_verbose" << ' ,' << " exec" << ' ,' << nodeImplementer << ' ,' << nodeName << " :" << nodeType << " :"
187- << nodeAlg << ' ,' << nodePrimImplType << ' ,' << portsInfo << ' ,' << post_ops << ' ,' ;
185+ m_stream << " ov_cpu_verbose" << ' ,' << " exec" << ' ,' << nodeImplementer << ' ,' << nodeName << " :" << nodeType << " :"
186+ << nodeAlg << ' ,' << nodePrimImplType << ' ,' << portsInfo << ' ,' << post_ops << ' ,' ;
188187}
189188
190189void Verbose::printDuration () {
191- const auto & duration = node ->PerfCounter ().duration ().count ();
192- stream << duration << " ms" ;
190+ const auto & duration = m_node ->PerfCounter ().duration ().count ();
191+ m_stream << duration << " ms" ;
193192}
194193
195194void Verbose::flush () const {
196- std::cout << stream .rdbuf () << " \n " ;
195+ std::cout << m_stream .rdbuf () << " \n " ;
197196}
198197
199198} // namespace ov::intel_cpu
0 commit comments