diff --git a/db/internal_stats.cc b/db/internal_stats.cc index a91883975dd3d7dbdff5ce01716b5eca3ceee07f..abe4b660744db12f7f32d42c24553fb10768fa6e 100644 --- a/db/internal_stats.cc +++ b/db/internal_stats.cc @@ -23,6 +23,7 @@ #include "cache/cache_entry_stats.h" #include "db/column_family.h" #include "db/db_impl/db_impl.h" +#include "port/port.h" #include "rocksdb/system_clock.h" #include "rocksdb/table.h" #include "table/block_based/cachable_entry.h" @@ -602,7 +603,8 @@ void InternalStats::CacheEntryRoleStats::BeginCollection( ++collection_count; role_map_ = CopyCacheDeleterRoleMap(); std::ostringstream str; - str << cache->Name() << "@" << static_cast(cache); + str << cache->Name() << "@" << static_cast(cache) << "#" + << port::GetProcessID(); cache_id = str.str(); cache_capacity = cache->GetCapacity(); } diff --git a/port/port_posix.cc b/port/port_posix.cc index 112984de2963c89376c0a9891aede8af526e2414..57f19e33d8aedd3e97c52dd8d1a1c9b5cc288392 100644 --- a/port/port_posix.cc +++ b/port/port_posix.cc @@ -263,6 +263,8 @@ void SetCpuPriority(ThreadId id, CpuPriority priority) { #endif } +int64_t GetProcessID() { return getpid(); } + } // namespace port } // namespace ROCKSDB_NAMESPACE diff --git a/port/port_posix.h b/port/port_posix.h index 90f131e13104bb0d7f50cb1b7f119aa9d64f654e..fa23f9c336e7ea71049e37058834d5d7345520b5 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -219,5 +219,7 @@ using ThreadId = pid_t; extern void SetCpuPriority(ThreadId id, CpuPriority priority); +int64_t GetProcessID(); + } // namespace port } // namespace ROCKSDB_NAMESPACE diff --git a/port/win/port_win.cc b/port/win/port_win.cc index bd7b55f42789ea8bd9ec05dc3bdba8460b2f8901..b28a44895517b51d38b2a6b2fbe448a079856f33 100644 --- a/port/win/port_win.cc +++ b/port/win/port_win.cc @@ -277,6 +277,8 @@ void SetCpuPriority(ThreadId id, CpuPriority priority) { (void)priority; } +int64_t GetProcessID() { return GetCurrentProcessId(); } + } // namespace port } // namespace ROCKSDB_NAMESPACE diff --git a/port/win/port_win.h b/port/win/port_win.h index a6a6de2780194527f909341665c05debefea1b38..7de9b61c519a7c8ed2c8cb53891b8f9d9bc51076 100644 --- a/port/win/port_win.h +++ b/port/win/port_win.h @@ -347,6 +347,8 @@ using ThreadId = int; extern void SetCpuPriority(ThreadId id, CpuPriority priority); +int64_t GetProcessID(); + } // namespace port