Changeset 259652 in webkit
- Timestamp:
- Apr 7, 2020 11:41:13 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/ChangeLog
r259582 r259652 1 2020-04-07 Saam Barati <sbarati@apple.com> 2 3 RAMification should have a way of gathering vmmaps for each test at the end of each run 4 https://bugs.webkit.org/show_bug.cgi?id=210060 5 6 Reviewed by Yusuke Suzuki. 7 8 When I was debugging a memory issue, I needed to gather vmmaps for each 9 RAMification subtest. This patch is checking in the code I wrote to be able 10 to do this. It works by: 11 - Passing in an argument to RAMification saying we want vmmaps at the end of 12 each subtest run. 13 - RAMification invokes jsc with an environment variable that tells the shell 14 to wait for one character of input from stdin before exiting. 15 - The jsc shell also disables the bmalloc scavenger while waiting for input so the 16 vmmap we take from the python runner script represents the "footprint" score 17 of the benchmark. If the scavenger ran, it would end up releasing too much 18 memory for the vmmap to be useful. 19 - The python script runs a vmmap, and then communicates to the jsc process 20 when the vmmap finishes running. 21 22 * JetStream2/RAMification.py: 23 (parseArgs): 24 (BaseRunner.__init__): 25 (BaseRunner.getResults): 26 (LocalRunner.runOneTest): 27 (main): 28 (main.runTestList): 29 1 30 2020-04-06 Saam Barati <sbarati@apple.com> 2 31 -
trunk/PerformanceTests/JetStream2/RAMification.py
r259098 r259652 44 44 peakFootprintRE = re.compile("Peak Footprint: (\d+(?:.\d+)?)") 45 45 46 TestResult = collections.namedtuple("TestResult", ["name", "returnCode", "footprint", "peakFootprint" ])46 TestResult = collections.namedtuple("TestResult", ["name", "returnCode", "footprint", "peakFootprint", "vmmapOutput"]) 47 47 48 48 ramification_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) … … 121 121 parser.add_argument("-n", "--run-no-jit", dest="runNoJITTests", nargs="?", const=True, default=None, type=optStrToBool, metavar="true / false", help="Run no JIT tests [default]") 122 122 parser.add_argument("-o", "--output", dest="jsonFilename", type=str, default=None, metavar="JSON-output-file", help="Path to JSON output") 123 parser.add_argument("-m", "--vmmap", dest="takeVmmap", action="store_true", default=False, help="Take a vmmap after each test") 123 124 124 125 args = parser.parse_args() … … 147 148 self.rootDir = args.testDir 148 149 self.environmentVars = {} 150 self.vmmapOutput = "" 149 151 150 152 def setup(self): … … 179 181 180 182 def getResults(self): 181 return TestResult(name=self.testName, returnCode=self.returnCode, footprint=self.footprint, peakFootprint=self.peakFootprint )183 return TestResult(name=self.testName, returnCode=self.returnCode, footprint=self.footprint, peakFootprint=self.peakFootprint, vmmapOutput=self.vmmapOutput) 182 184 183 185 … … 201 203 self.resetForTest(test) 202 204 203 proc = subprocess.Popen(args, cwd=self.rootDir, env=self.environmentVars, stdout=subprocess.PIPE, std err=None, shell=False)205 proc = subprocess.Popen(args, cwd=self.rootDir, env=self.environmentVars, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=None, shell=False) 204 206 while True: 205 207 line = proc.stdout.readline() … … 208 210 209 211 self.processLine(line) 212 213 if "js shell waiting for input to exit" in line: 214 self.vmmapOutput = subprocess.Popen(['vmmap', '--summary', '{}'.format(proc.pid)], shell=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE).stdout.read() 215 if sys.version_info[0] >= 3: 216 self.vmmapOutput = str(self.vmmapOutput, "utf-8") 217 proc.stdin.write(b"done\n") 218 proc.stdin.flush() 210 219 211 220 if line == "": … … 226 235 227 236 testRunner = args.runner(args) 237 238 239 if args.takeVmmap: 240 testRunner.setEnv("JS_SHELL_WAIT_FOR_INPUT_TO_EXIT", "1") 228 241 229 242 dyldFrameworkPath = frameworkPathFromExecutablePath(args.jscCommand) … … 256 269 if args.verbose: 257 270 print("footprint: {}, peak footprint: {}".format(testResult.footprint, testResult.peakFootprint)) 271 if testResult.vmmapOutput: 272 print(testResult.vmmapOutput) 258 273 else: 259 274 print -
trunk/Source/JavaScriptCore/ChangeLog
r259646 r259652 1 2020-04-07 Saam Barati <sbarati@apple.com> 2 3 RAMification should have a way of gathering vmmaps for each test at the end of each run 4 https://bugs.webkit.org/show_bug.cgi?id=210060 5 6 Reviewed by Yusuke Suzuki. 7 8 * jsc.cpp: 9 (main): 10 1 11 2020-04-07 Yusuke Suzuki <ysuzuki@apple.com> 2 12 -
trunk/Source/JavaScriptCore/jsc.cpp
r259636 r259652 2529 2529 EXCEPT(res = 3) 2530 2530 finalizeStatsAtEndOfTesting(); 2531 if (getenv("JS_SHELL_WAIT_FOR_INPUT_TO_EXIT")) { 2532 WTF::fastDisableScavenger(); 2533 fprintf(stdout, "\njs shell waiting for input to exit\n"); 2534 fflush(stdout); 2535 getc(stdin); 2536 } 2531 2537 2532 2538 jscExit(res); -
trunk/Source/WTF/ChangeLog
r259606 r259652 1 2020-04-07 Saam Barati <sbarati@apple.com> 2 3 RAMification should have a way of gathering vmmaps for each test at the end of each run 4 https://bugs.webkit.org/show_bug.cgi?id=210060 5 6 Reviewed by Yusuke Suzuki. 7 8 * wtf/FastMalloc.cpp: 9 (WTF::fastDisableScavenger): 10 * wtf/FastMalloc.h: 11 1 12 2020-04-06 Ross Kirsling <ross.kirsling@sony.com> 2 13 -
trunk/Source/WTF/wtf/FastMalloc.cpp
r253987 r259652 275 275 void fastEnableMiniMode() { } 276 276 277 void fastDisableScavenger() { } 278 277 279 void fastMallocDumpMallocStats() { } 278 280 … … 633 635 } 634 636 637 void fastDisableScavenger() 638 { 639 bmalloc::api::disableScavenger(); 640 } 641 635 642 } // namespace WTF 636 643 -
trunk/Source/WTF/wtf/FastMalloc.h
r253987 r259652 77 77 WTF_EXPORT_PRIVATE void fastEnableMiniMode(); 78 78 79 WTF_EXPORT_PRIVATE void fastDisableScavenger(); 80 79 81 struct FastMallocStatistics { 80 82 size_t reservedVMBytes; -
trunk/Source/bmalloc/ChangeLog
r259466 r259652 1 2020-04-07 Saam Barati <sbarati@apple.com> 2 3 RAMification should have a way of gathering vmmaps for each test at the end of each run 4 https://bugs.webkit.org/show_bug.cgi?id=210060 5 6 Reviewed by Yusuke Suzuki. 7 8 * bmalloc/Scavenger.cpp: 9 (bmalloc::Scavenger::scavenge): 10 (bmalloc::Scavenger::partialScavenge): 11 * bmalloc/Scavenger.h: 12 (bmalloc::Scavenger::disable): 13 * bmalloc/bmalloc.cpp: 14 (bmalloc::api::disableScavenger): 15 * bmalloc/bmalloc.h: 16 1 17 2020-04-03 David Kilzer <ddkilzer@apple.com> 2 18 -
trunk/Source/bmalloc/bmalloc/Scavenger.cpp
r257554 r259652 205 205 void Scavenger::scavenge() 206 206 { 207 if (!m_isEnabled) 208 return; 209 207 210 UniqueLockHolder lock(m_scavengingMutex); 208 211 … … 280 283 void Scavenger::partialScavenge() 281 284 { 285 if (!m_isEnabled) 286 return; 287 282 288 UniqueLockHolder lock(m_scavengingMutex); 283 289 -
trunk/Source/bmalloc/bmalloc/Scavenger.h
r254871 r259652 75 75 void enableMiniMode(); 76 76 77 // Used for debugging only. 78 void disable() { m_isEnabled = false; } 79 77 80 private: 78 81 enum class State { Sleep, Run, RunSoon }; … … 116 119 117 120 Vector<DeferredDecommit> m_deferredDecommits; 121 bool m_isEnabled { true }; 118 122 }; 119 123 DECLARE_STATIC_PER_PROCESS_STORAGE(Scavenger); -
trunk/Source/bmalloc/bmalloc/bmalloc.cpp
r254781 r259652 136 136 } 137 137 138 void disableScavenger() 139 { 140 if (!DebugHeap::tryGet()) 141 Scavenger::get()->disable(); 142 } 143 138 144 } } // namespace bmalloc::api 139 145 -
trunk/Source/bmalloc/bmalloc/bmalloc.h
r244244 r259652 130 130 BEXPORT void enableMiniMode(); 131 131 132 // Used for debugging only. 133 BEXPORT void disableScavenger(); 134 132 135 } // namespace api 133 136 } // namespace bmalloc
Note: See TracChangeset
for help on using the changeset viewer.