summaryrefslogtreecommitdiff
path: root/Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
downloadqtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp')
-rw-r--r--Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp b/Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp
index 31e95eaf0..e53da0c04 100644
--- a/Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp
+++ b/Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp
@@ -30,9 +30,9 @@
#include "NotImplemented.h"
#include <JavaScriptCore/MemoryStatistics.h>
+#include <runtime/JSCInlines.h>
#include <WebCore/JSDOMWindow.h>
#include <runtime/JSLock.h>
-#include <runtime/Operations.h>
#include <string.h>
#include <sys/sysinfo.h>
#include <wtf/CurrentTime.h>
@@ -66,7 +66,7 @@ static inline String nextToken(FILE* file)
char buffer[maxBuffer] = {0, };
unsigned int index = 0;
while (index < maxBuffer) {
- char ch = fgetc(file);
+ int ch = fgetc(file);
if (ch == EOF || (isASCIISpace(ch) && index)) // Break on non-initial ASCII space.
break;
if (!isASCIISpace(ch)) {
@@ -86,7 +86,7 @@ static inline void appendKeyValuePair(WebMemoryStatistics& stats, const String&
static ApplicationMemoryStats sampleMemoryAllocatedForApplication()
{
- ApplicationMemoryStats applicationStats;
+ ApplicationMemoryStats applicationStats = {0, 0, 0, 0, 0, 0, 0};
char processPath[maxProcessPath];
snprintf(processPath, maxProcessPath, "/proc/self/statm");
FILE* statmFileDescriptor = fopen(processPath, "r");
@@ -143,7 +143,6 @@ WebMemoryStatistics WebMemorySampler::sampleWebKit() const
size_t totalBytesInUse = 0;
size_t totalBytesCommitted = 0;
-#if ENABLE(GLOBAL_FASTMALLOC_NEW)
FastMallocStatistics fastMallocStatistics = WTF::fastMallocStatistics();
size_t fastMallocBytesInUse = fastMallocStatistics.committedVMBytes - fastMallocStatistics.freeListBytes;
size_t fastMallocBytesCommitted = fastMallocStatistics.committedVMBytes;
@@ -152,10 +151,9 @@ WebMemoryStatistics WebMemorySampler::sampleWebKit() const
appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Fast Malloc In Use"), fastMallocBytesInUse);
appendKeyValuePair(webKitMemoryStats, ASCIILiteral("Fast Malloc Committed Memory"), fastMallocBytesCommitted);
-#endif
- size_t jscHeapBytesInUse = JSDOMWindow::commonVM()->heap.size();
- size_t jscHeapBytesCommitted = JSDOMWindow::commonVM()->heap.capacity();
+ size_t jscHeapBytesInUse = JSDOMWindow::commonVM().heap.size();
+ size_t jscHeapBytesCommitted = JSDOMWindow::commonVM().heap.capacity();
totalBytesInUse += jscHeapBytesInUse;
totalBytesCommitted += jscHeapBytesCommitted;
@@ -164,7 +162,7 @@ WebMemoryStatistics WebMemorySampler::sampleWebKit() const
totalBytesCommitted += globalMemoryStats.stackBytes + globalMemoryStats.JITBytes;
appendKeyValuePair(webKitMemoryStats, ASCIILiteral("JavaScript Heap In Use"), jscHeapBytesInUse);
- appendKeyValuePair(webKitMemoryStats, ASCIILiteral("JavaScript Heap Commited Memory"), jscHeapBytesCommitted);
+ appendKeyValuePair(webKitMemoryStats, ASCIILiteral("JavaScript Heap Committed Memory"), jscHeapBytesCommitted);
appendKeyValuePair(webKitMemoryStats, ASCIILiteral("JavaScript Stack Bytes"), globalMemoryStats.stackBytes);
appendKeyValuePair(webKitMemoryStats, ASCIILiteral("JavaScript JIT Bytes"), globalMemoryStats.JITBytes);