Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnick committed Jan 15, 2025
1 parent 0382ce8 commit 158285f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/utils/debug_caps_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DebugCapsConfig {
std::unordered_map<FILTER, std::string, EnumClassHash> blobDumpFilters;
std::string summaryPerf = "";
std::string memoryStatisticsDumpPath;
unsigned memoryStatisticsDumpLevel = 0; // 0 - no, 1 - only the main graph, 2 - all subgraphs
unsigned memoryStatisticsDumpLevel = 0; // 0 - don't print statistics, 1 - print statistics

struct TransformationFilter {
enum Type : uint8_t { PreLpt = 0, Lpt, PostLpt, Snippets, Specific, NumOfTypes };
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_cpu/src/utils/memory_stats_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ void dumpMemoryStats(const DebugCapsConfig& conf,
return;
}

std::filesystem::path csv_path = conf.memoryStatisticsDumpPath;
if (!csv_path.empty()) {
if (!conf.memoryStatisticsDumpPath.empty()) {
std::filesystem::path csv_path = conf.memoryStatisticsDumpPath;
// check the last symbols in the file path are csv
if (csv_path.extension() != ".csv") {
OPENVINO_THROW("Unsupported memory stats file extension. Should be '*.csv'. Got ", csv_path.filename());
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/intel_cpu/src/weights_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const WeightsSharing::Ptr& SocketsWeights::operator[](int socket_id) const {
return found->second;
}

#ifdef CPU_DEBUG_CAPS
WeightsSharing::Statistics WeightsSharing::dumpStatistics() const {
Statistics retVal = {0, 0};

Expand All @@ -115,5 +116,6 @@ std::vector<std::pair<int, WeightsSharing::Statistics>> SocketsWeights::dumpStat

return retVal;
}
#endif // CPU_DEBUG_CAPS
} // namespace intel_cpu
} // namespace ov
6 changes: 6 additions & 0 deletions src/plugins/intel_cpu/src/weights_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ class WeightsSharing {
};

public:
#ifdef CPU_DEBUG_CAPS
struct Statistics {
size_t total_size; // bytes
size_t total_memory_objects;
};
#endif // CPU_DEBUG_CAPS

typedef std::shared_ptr<WeightsSharing> Ptr;

Expand All @@ -67,7 +69,9 @@ class WeightsSharing {

SharedMemory::Ptr get(const std::string& key) const;

#ifdef CPU_DEBUG_CAPS
Statistics dumpStatistics() const;
#endif // CPU_DEBUG_CAPS

protected:
mutable std::mutex guard;
Expand All @@ -86,7 +90,9 @@ class SocketsWeights {
WeightsSharing::Ptr& operator[](int i);
const WeightsSharing::Ptr& operator[](int i) const;

#ifdef CPU_DEBUG_CAPS
std::vector<std::pair<int, WeightsSharing::Statistics>> dumpStatistics() const;
#endif // CPU_DEBUG_CAPS

private:
std::map<int, WeightsSharing::Ptr> _cache_map;
Expand Down

0 comments on commit 158285f

Please sign in to comment.