Changeset 208538 in webkit
- Timestamp:
- Nov 10, 2016 8:03:51 AM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r208534 r208538 1 2016-11-10 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [Linux] Memory process values shown by the WebMemorySampler in linux are wrong 4 https://bugs.webkit.org/show_bug.cgi?id=164591 5 6 Reviewed by Michael Catanzaro. 7 8 It's parsing /proc/self/statm, and returning the values as if they were bytes, but they are number of pages, so 9 to get the bytes we need to take the page size into account. In r208534 I added a method to get /proc/self/statm 10 values in bytes to Platform layer, so we can simply use that instead. 11 12 * Shared/linux/WebMemorySamplerLinux.cpp: 13 (WebKit::WebMemorySampler::sampleWebKit): Use currentProcessMemoryStatus() and update the descriptions to 14 clarify that values are in bytes. 15 1 16 2016-10-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 17 -
trunk/Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp
r198527 r208538 29 29 #if ENABLE(MEMORY_SAMPLER) 30 30 31 #include "NotImplemented.h"32 31 #include <JavaScriptCore/MemoryStatistics.h> 32 #include <WebCore/CurrentProcessMemoryStatus.h> 33 #include <WebCore/JSDOMWindow.h> 34 #include <WebCore/NotImplemented.h> 33 35 #include <runtime/JSCInlines.h> 34 #include <WebCore/JSDOMWindow.h>35 36 #include <runtime/JSLock.h> 36 37 #include <string.h> … … 44 45 45 46 namespace WebKit { 46 47 struct ApplicationMemoryStats {48 size_t totalProgramSize;49 size_t residentSetSize;50 size_t sharedSize;51 size_t textSize;52 size_t librarySize;53 size_t dataStackSize;54 size_t dirtyPageSize;55 };56 47 57 48 static const unsigned int maxBuffer = 128; … … 85 76 } 86 77 87 static ApplicationMemoryStats sampleMemoryAllocatedForApplication()88 {89 ApplicationMemoryStats applicationStats = {0, 0, 0, 0, 0, 0, 0};90 char processPath[maxProcessPath];91 snprintf(processPath, maxProcessPath, "/proc/self/statm");92 FILE* statmFileDescriptor = fopen(processPath, "r");93 if (!statmFileDescriptor)94 return applicationStats;95 96 applicationStats.totalProgramSize = nextToken(statmFileDescriptor).toInt();97 applicationStats.residentSetSize = nextToken(statmFileDescriptor).toInt();98 applicationStats.sharedSize = nextToken(statmFileDescriptor).toInt();99 applicationStats.textSize = nextToken(statmFileDescriptor).toInt();100 applicationStats.librarySize = nextToken(statmFileDescriptor).toInt();101 applicationStats.dataStackSize = nextToken(statmFileDescriptor).toInt();102 applicationStats.dirtyPageSize = nextToken(statmFileDescriptor).toInt();103 104 fclose(statmFileDescriptor);105 106 return applicationStats;107 }108 109 78 String WebMemorySampler::processName() const 110 79 { … … 131 100 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Timestamp"), now); 132 101 133 ApplicationMemoryStats applicationStats = sampleMemoryAllocatedForApplication(); 102 ProcessMemoryStatus processMemoryStatus; 103 currentProcessMemoryStatus(processMemoryStatus); 134 104 135 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Total Program Size"), applicationStats.totalProgramSize);136 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("R SS"), applicationStats.residentSetSize);137 appendKeyValuePair(webKitMemoryStats, ASCIILiteral(" Shared"), applicationStats.sharedSize);138 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Text "), applicationStats.textSize);139 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Library "), applicationStats.librarySize);140 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Data /Stack"), applicationStats.dataStackSize);141 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Dirty "), applicationStats.dirtyPageSize);105 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Total Program Bytes"), processMemoryStatus.size); 106 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Resident Set Bytes"), processMemoryStatus.resident); 107 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Resident Shared Bytes"), processMemoryStatus.shared); 108 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Text Bytes"), processMemoryStatus.text); 109 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Library Bytes"), processMemoryStatus.lib); 110 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Data + Stack Bytes"), processMemoryStatus.data); 111 appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Dirty Bytes"), processMemoryStatus.dt); 142 112 143 113 size_t totalBytesInUse = 0;
Note: See TracChangeset
for help on using the changeset viewer.