mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@13457 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6f3a7eca14
commit
7b8b997493
4 changed files with 95 additions and 0 deletions
34
benchmarks/HeapIde/HeapIde.cpp
Normal file
34
benchmarks/HeapIde/HeapIde.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
void *ptr[10000000];
|
||||
|
||||
struct Record {
|
||||
int tid;
|
||||
int ptr;
|
||||
size_t sz;
|
||||
};
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
String name = "c:/xxx/heap.bog";
|
||||
|
||||
int64 l = GetFileLength(name);
|
||||
Record *r = (Record *)malloc(l);
|
||||
FileIn in(name);
|
||||
if((l & 15) || in.Get64(r, l) != l) {
|
||||
Cout() << "Invalid input";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
RTIMING("Heap");
|
||||
Record *end = r + l / 16;
|
||||
while(r < end) {
|
||||
if(r->sz == 0xffffffffffffffff)
|
||||
MemoryFree(ptr[r->ptr]);
|
||||
else
|
||||
ptr[r->ptr] = MemoryAlloc(r->sz);
|
||||
r++;
|
||||
}
|
||||
}
|
||||
10
benchmarks/HeapIde/HeapIde.upp
Normal file
10
benchmarks/HeapIde/HeapIde.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
HeapIde.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "",
|
||||
"" = "USEMALLOC";
|
||||
|
||||
42
benchmarks/HeapLog/HeapLog.cpp
Normal file
42
benchmarks/HeapLog/HeapLog.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
SetVppLogSizeLimit(INT_MAX);
|
||||
|
||||
FileIn in("C:/upp/heap.log");
|
||||
FileOut out("C:/xxx/heap.bog");
|
||||
|
||||
Index<int> th;
|
||||
Index<int64> ps;
|
||||
|
||||
while(!in.IsEof()) {
|
||||
String s = in.GetLine();
|
||||
CParser p(s);
|
||||
if(p.Char('-')) {
|
||||
int tid = p.ReadNumber(16);
|
||||
int64 ptr = p.ReadNumber64(16);
|
||||
int t = th.Find(tid);
|
||||
int q = ps.Find(ptr);
|
||||
if(q >= 0) {
|
||||
out.Put32(th.Find(tid));
|
||||
out.Put32(q);
|
||||
out.Put64(0xffffffffffffffff);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int tid = p.ReadNumber(16);
|
||||
int64 sz = p.ReadNumber64(16);
|
||||
int64 ptr = p.ReadNumber64(16);
|
||||
int t = th.FindAdd(tid);
|
||||
int q = ps.FindAdd(ptr);
|
||||
out.Put32(th.Find(tid));
|
||||
out.Put32(q);
|
||||
out.Put64(sz);
|
||||
}
|
||||
}
|
||||
RDUMP(ps.GetCount());
|
||||
RDUMP(th.GetCount());
|
||||
}
|
||||
9
benchmarks/HeapLog/HeapLog.upp
Normal file
9
benchmarks/HeapLog/HeapLog.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
HeapLog.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue