Skip to content

Commit b6da372

Browse files
Set logLevel=3 for informative logs in PyperfNativeStack
1 parent 9cc65a8 commit b6da372

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

examples/cpp/pyperf/PyPerfNativeStackTrace.cc

+10-10
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ NativeStackTrace::NativeStackTrace(uint32_t pid, const unsigned char *raw_stack,
6060

6161
// Check whether the entry for the process ID is presented in the cache
6262
if (!is_cached(cache, pid)) {
63-
logInfo(2,"The given key %d is not presented in the cache\n", pid);
63+
logInfo(3,"The given key %d is not presented in the cache\n", pid);
6464

6565
as = unw_create_addr_space(&my_accessors, 0);
6666
upt = _UPT_create(pid);
@@ -85,7 +85,7 @@ NativeStackTrace::NativeStackTrace(uint32_t pid, const unsigned char *raw_stack,
8585
cache_put(cache, pid, cursor, as, upt);
8686

8787
} else {
88-
logInfo(2,"Found entry for the given key %d in the cache\n", pid);
88+
logInfo(3,"Found entry for the given key %d in the cache\n", pid);
8989
// Get from the cache
9090
UnwindCacheEntry cached_entry = cache_get(cache, pid);
9191
cursor = cached_entry.cursor;
@@ -236,7 +236,7 @@ bool NativeStackTrace::is_cached(const UnwindCache &map, const uint32_t &key) {
236236
return true;
237237
}
238238
catch (const std::out_of_range&) {
239-
logInfo(2, "No entry for %d in the cache\n", key);
239+
logInfo(3, "No entry for %d in the cache\n", key);
240240
}
241241
return false;
242242
}
@@ -250,14 +250,14 @@ UnwindCacheEntry NativeStackTrace::cache_get(const UnwindCache &map, const uint3
250250
void NativeStackTrace::cache_put(UnwindCache &mp, const uint32_t &key, const unw_cursor_t cursor, const unw_addr_space_t as, void *upt) {
251251
// Check available capacity
252252
if (cache_size() > NativeStackTrace::CacheMaxSizeMB*1024*1024 - cache_single_entry_size()) {
253-
logInfo(2, "The cache usage is %.2f MB, close to reaching the max memory usage (%d MB)\n", cache_size_KB()/1024, NativeStackTrace::CacheMaxSizeMB);
254-
logInfo(2, "Skipping adding an entry for %d to the cache\n", key);
253+
logInfo(3, "The cache usage is %.2f MB, close to reaching the max memory usage (%d MB)\n", cache_size_KB()/1024, NativeStackTrace::CacheMaxSizeMB);
254+
logInfo(3, "Skipping adding an entry for %d to the cache\n", key);
255255
return;
256256
}
257257

258258
UnwindCacheEntry entry = {cursor, as, upt, now};
259259
mp[key] = entry;
260-
logInfo(2, "New entry for %d was added to the cache\n", key);
260+
logInfo(3, "New entry for %d was added to the cache\n", key);
261261
}
262262

263263
// cache_delete_key removes the element from the cache and destroys unwind address space and UPT
@@ -268,13 +268,13 @@ bool NativeStackTrace::cache_delete_key(UnwindCache &mp, const uint32_t &key) {
268268
e = cache_get(mp, key);
269269
}
270270
catch (const std::out_of_range&) {
271-
logInfo(2, "Failed to delete entry for %d: no such key in the cache\n", key);
271+
logInfo(3, "Failed to delete entry for %d: no such key in the cache\n", key);
272272
return false;
273273
}
274274

275275
mp.erase(key);
276276
cleanup(e.upt, e.as);
277-
logInfo(2, "The entry for %d was deleted from the cache\n", key);
277+
logInfo(3, "The entry for %d was deleted from the cache\n", key);
278278
return true;
279279
}
280280

@@ -315,8 +315,8 @@ void NativeStackTrace::cache_eviction(UnwindCache &mp) {
315315

316316
if (keys_to_delete.size() > 0) {
317317
float _cache_size = cache_size_KB();
318-
logInfo(2,"Evicted %d item(s) from the cache\n", keys_to_delete.size());
319-
logInfo(2,"The cache usage after eviction action is %.2f KB (released %.2f KB)\n", _cache_size, _prev_cache_size - _cache_size);
318+
logInfo(3,"Evicted %d item(s) from the cache\n", keys_to_delete.size());
319+
logInfo(3,"The cache usage after eviction action is %.2f KB (released %.2f KB)\n", _cache_size, _prev_cache_size - _cache_size);
320320
}
321321
}
322322

0 commit comments

Comments
 (0)