haikuwebkit/PerformanceTests/MallocBench/MallocBench/CPUCount.h

34 lines
1.4 KiB
C
Raw Permalink Normal View History

Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
/*
* Copyright (C) 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CPUCount_h
#define CPUCount_h
#include <stddef.h>
size_t cpuCount();
#endif // CPUCount_h