Fix some issues in MallocBench
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Feb 2016 17:58:58 +0000 (17:58 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Feb 2016 17:58:58 +0000 (17:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154600

Reviewed by Oliver Hunt.

* MallocBench/MallocBench.xcodeproj/project.pbxproj: Make nimlang.ops
a part of the build so that it copies to the right place for execution.

* MallocBench/MallocBench/Interpreter.cpp:
(Interpreter::Interpreter): Don't try to open .ops files for writing
because we're only going to read and we might need extra permissions to
write.

(Interpreter::~Interpreter): Give more context when opening a file fails
to help with debugging.

* MallocBench/MallocBench/stress.cpp:
(benchmark_stress): Reduce iterations to complete in less than 10 seconds.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197175 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj
PerformanceTests/MallocBench/MallocBench/Interpreter.cpp
PerformanceTests/MallocBench/MallocBench/stress.cpp

index f765baa..01b7e0e 100644 (file)
@@ -1,3 +1,24 @@
+2016-02-23  Geoffrey Garen  <ggaren@apple.com>
+
+        Fix some issues in MallocBench
+        https://bugs.webkit.org/show_bug.cgi?id=154600
+
+        Reviewed by Oliver Hunt.
+
+        * MallocBench/MallocBench.xcodeproj/project.pbxproj: Make nimlang.ops
+        a part of the build so that it copies to the right place for execution.
+
+        * MallocBench/MallocBench/Interpreter.cpp:
+        (Interpreter::Interpreter): Don't try to open .ops files for writing
+        because we're only going to read and we might need extra permissions to
+        write.
+
+        (Interpreter::~Interpreter): Give more context when opening a file fails
+        to help with debugging.
+
+        * MallocBench/MallocBench/stress.cpp:
+        (benchmark_stress): Reduce iterations to complete in less than 10 seconds.
+
 2016-02-23  Michael Saboff  <msaboff@apple.com>
 
         Unreviewed change to revert extraneous changes made part of change set 196955.
index d847fc1..1ff3167 100644 (file)
@@ -24,6 +24,7 @@
                1447AE9A18FB59E300B3D7FF /* reddit_memory_warning.ops in Copy Files */ = {isa = PBXBuildFile; fileRef = 1447AE9718FB59D900B3D7FF /* reddit_memory_warning.ops */; };
                1447AE9B18FB59E600B3D7FF /* theverge_memory_warning.ops in Copy Files */ = {isa = PBXBuildFile; fileRef = 1447AE9818FB59D900B3D7FF /* theverge_memory_warning.ops */; };
                1451FAED18B14B7100DB6D47 /* medium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1451FAEB18B14B7100DB6D47 /* medium.cpp */; };
+               1486502A1C7CF1CC008AABFE /* nimlang.ops in Copy Files */ = {isa = PBXBuildFile; fileRef = 148650291C7CF182008AABFE /* nimlang.ops */; };
                14976EC8177E3649006B819A /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14976EC6177E3649006B819A /* list.cpp */; };
                14976ECC177E3C87006B819A /* CommandLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14976ECB177E3C87006B819A /* CommandLine.cpp */; };
                14976ECE177E3D67006B819A /* Benchmark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14976ECD177E3D67006B819A /* Benchmark.cpp */; };
@@ -49,6 +50,7 @@
                        dstPath = "";
                        dstSubfolderSpec = 7;
                        files = (
+                               1486502A1C7CF1CC008AABFE /* nimlang.ops in Copy Files */,
                                1447AE9418FB589400B3D7FF /* reddit.ops in Copy Files */,
                                1447AE9918FB59E000B3D7FF /* flickr_memory_warning.ops in Copy Files */,
                                1447AE9B18FB59E600B3D7FF /* theverge_memory_warning.ops in Copy Files */,
@@ -90,6 +92,7 @@
                1447AE9818FB59D900B3D7FF /* theverge_memory_warning.ops */ = {isa = PBXFileReference; lastKnownFileType = file; name = theverge_memory_warning.ops; path = MallocBench/theverge_memory_warning.ops; sourceTree = "<group>"; };
                1451FAEB18B14B7100DB6D47 /* medium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = medium.cpp; path = MallocBench/medium.cpp; sourceTree = "<group>"; };
                1451FAEC18B14B7100DB6D47 /* medium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = medium.h; path = MallocBench/medium.h; sourceTree = "<group>"; };
+               148650291C7CF182008AABFE /* nimlang.ops */ = {isa = PBXFileReference; lastKnownFileType = file; name = nimlang.ops; path = MallocBench/nimlang.ops; sourceTree = "<group>"; };
                14976EC6177E3649006B819A /* list.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = list.cpp; path = MallocBench/list.cpp; sourceTree = "<group>"; };
                14976EC7177E3649006B819A /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = list.h; path = MallocBench/list.h; sourceTree = "<group>"; };
                14976EC9177E3B4A006B819A /* Benchmark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Benchmark.h; sourceTree = "<group>"; };
                65E401A51C657A87003C6E9C /* nimlang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nimlang.h; path = MallocBench/nimlang.h; sourceTree = "<group>"; };
                65E401AA1C73B068003C6E9C /* alloc_free.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = alloc_free.cpp; path = MallocBench/alloc_free.cpp; sourceTree = "<group>"; };
                65E401AB1C73B068003C6E9C /* alloc_free.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = alloc_free.h; path = MallocBench/alloc_free.h; sourceTree = "<group>"; };
-               65E401AD1C77E7C8003C6E9C /* nimlang.ops */ = {isa = PBXFileReference; lastKnownFileType = file; name = nimlang.ops; path = MallocBench/nimlang.ops; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
                                1444AE95177E8DF200F8030A /* message.h */,
                                14105E8018E13EEC003A106E /* realloc.cpp */,
                                65E401A41C657A87003C6E9C /* nimlang.cpp */,
-                               65E401AD1C77E7C8003C6E9C /* nimlang.ops */,
                                65E401A51C657A87003C6E9C /* nimlang.h */,
+                               148650291C7CF182008AABFE /* nimlang.ops */,
                                14105E8118E13EEC003A106E /* realloc.h */,
                                1447AE9718FB59D900B3D7FF /* reddit_memory_warning.ops */,
                                1447AE8A18FB584200B3D7FF /* reddit.cpp */,
index 5789f32..7a1bb8f 100644 (file)
@@ -48,9 +48,12 @@ Interpreter::Interpreter(const char* fileName, bool shouldFreeAllObjects, bool u
     , m_currentThreadId(0)
     , m_ops(1024)
 {
-    m_fd = open(fileName, O_RDWR, S_IRUSR | S_IWUSR);
-    if (m_fd == -1)
-        fprintf(stderr, "failed to open\n");
+    m_fd = open(fileName, O_RDONLY);
+    if (m_fd == -1) {
+        fprintf(stderr, "Failed to open op file %s: ", fileName);
+        perror("");
+        exit(-1);
+    }
 
     struct stat buf;
     fstat(m_fd, &buf);
@@ -81,8 +84,10 @@ Interpreter::Interpreter(const char* fileName, bool shouldFreeAllObjects, bool u
 Interpreter::~Interpreter()
 {
     int result = close(m_fd);
-    if (result == -1)
-        fprintf(stderr, "failed to close\n");
+    if (result == -1) {
+        perror("Failed to close op file");
+        exit(-1);
+    }
 }
 
 void Interpreter::run()
index dd6b765..9517f42 100644 (file)
@@ -124,7 +124,7 @@ void benchmark_stress(CommandLine&)
 {
     const size_t heapSize = 100 * MB;
     const size_t churnSize = .05 * heapSize;
-    const size_t churnCount = 10000;
+    const size_t churnCount = 1000;
     
     srandom(1); // For consistency between runs.