]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/old/testnewbuffers.cc
7 #include "include/newbuffer.h"
8 //#include "include/bufferlist.h"
10 #include "common/Thread.h"
13 class Th
: public Thread
{
16 explicit Th(bufferlist
& o
) : bl(o
) { }
19 //cout << "start" << endl;
21 for (int n
=0; n
<10000; n
++) {
23 unsigned off
= rand() % (bl
.length() -1);
24 unsigned len
= 1 + rand() % (bl
.length() - off
- 1);
25 bl2
.substr_of(bl
, off
, len
);
29 //cout << bl3 << endl;
33 //cout << "end" << endl;
40 bufferptr p1
= buffer::copy("123456",7);
41 //bufferptr p1 = new buffer("123456",7);
44 cout
<< "p1 is '" << p1
.c_str() << "'" << " " << p1
<< endl
;
45 cout
<< "p2 is '" << p2
.c_str() << "'" << " " << p2
<< endl
;
47 bufferptr p3
= buffer::copy("abcdef",7);
48 //bufferptr p3 = new buffer("abcdef",7);
50 cout
<< "p3 is " << p3
.c_str() << " " << p3
<< endl
;
57 cout
<< "bl is " << bl
<< endl
;
60 bl
.splice(10,4,&took
);
62 cout
<< "took out " << took
<< ", leftover is " << bl
<< endl
;
63 //cout << "len is " << bl.length() << endl;
66 bl2
.substr_of(bl
, 3, 5);
67 cout
<< "bl2 is " << bl2
<< endl
;
70 cout
<< "bl before " << bl
<< endl
;
73 for (int t
=0; t
<40; t
++) {
75 cout
<< "create" << endl
;
83 cout
<< "join" << endl
;
89 cout
<< "bl after " << bl
<< endl
;