[Assorted-commits] SF.net SVN: assorted:[1291] ydb/trunk/src/tpcc
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-03-13 19:26:30
|
Revision: 1291 http://assorted.svn.sourceforge.net/assorted/?rev=1291&view=rev Author: yangzhang Date: 2009-03-13 19:26:08 +0000 (Fri, 13 Mar 2009) Log Message: ----------- simplified tpcc build; removed tpcc.cc Modified Paths: -------------- ydb/trunk/src/tpcc/Makefile Removed Paths: ------------- ydb/trunk/src/tpcc/tpcc.cc Modified: ydb/trunk/src/tpcc/Makefile =================================================================== --- ydb/trunk/src/tpcc/Makefile 2009-03-12 19:54:39 UTC (rev 1290) +++ ydb/trunk/src/tpcc/Makefile 2009-03-13 19:26:08 UTC (rev 1291) @@ -8,17 +8,10 @@ # Link withthe C++ standard library LDFLAGS=-lstdc++ -BINARIES = tpcc # btree_test randomgenerator_test tpccclient_test tpcctables_test tpccgenerator_test tpcc +BINARIES = tpccclient.o tpccgenerator.o tpcctables.o tpccdb.o clock.o randomgenerator.o all: $(BINARIES) -#btree_test: btree_test.o stupidunit.o -#randomgenerator_test: randomgenerator_test.o randomgenerator.o stupidunit.o -#tpccclient_test: tpccclient_test.o tpccclient.o randomgenerator.o stupidunit.o -#tpcctables_test: tpcctables_test.o tpcctables.o tpccdb.o randomgenerator.o stupidunit.o -#tpccgenerator_test: tpccgenerator_test.o tpccgenerator.o tpcctables.o tpccdb.o randomgenerator.o stupidunit.o -tpcc: tpcc.o tpccclient.o tpccgenerator.o tpcctables.o tpccdb.o clock.o randomgenerator.o - clean : rm -f *.o *.d $(BINARIES) Deleted: ydb/trunk/src/tpcc/tpcc.cc =================================================================== --- ydb/trunk/src/tpcc/tpcc.cc 2009-03-12 19:54:39 UTC (rev 1290) +++ ydb/trunk/src/tpcc/tpcc.cc 2009-03-13 19:26:08 UTC (rev 1291) @@ -1,72 +0,0 @@ -#define __STDC_FORMAT_MACROS -#include <climits> -#include <inttypes.h> - -#include "clock.h" -#include "randomgenerator.h" -#include "tpccclient.h" -#include "tpccgenerator.h" -#include "tpcctables.h" - - -int main(int argc, const char* argv[]) { - if (argc != 2) { - fprintf(stderr, "tpcc [num warehouses]\n"); - exit(1); - } - - long num_warehouses = strtol(argv[1], NULL, 10); - if (num_warehouses == LONG_MIN || num_warehouses == LONG_MAX) { - fprintf(stderr, "Bad warehouse number (%s)\n", argv[1]); - exit(1); - } - if (num_warehouses <= 0) { - fprintf(stderr, "Number of warehouses must be > 0 (was %ld)\n", num_warehouses); - exit(1); - } - if (num_warehouses > Warehouse::MAX_WAREHOUSE_ID) { - fprintf(stderr, "Number of warehouses must be <= %d (was %ld)\n", Warehouse::MAX_WAREHOUSE_ID, num_warehouses); - exit(1); - } - - TPCCTables* tables = new TPCCTables(); - SystemClock* clock = new SystemClock(); - - // Create a generator for filling the database. - RealRandomGenerator* random = new RealRandomGenerator(); - NURandC cLoad = NURandC::makeRandom(random); - random->setC(cLoad); - - // Generate the data - printf("Loading %ld warehouses... ", num_warehouses); - fflush(stdout); - char now[Clock::DATETIME_SIZE+1]; - clock->getDateTimestamp(now); - TPCCGenerator generator(random, now, Item::NUM_ITEMS, District::NUM_PER_WAREHOUSE, - Customer::NUM_PER_DISTRICT, NewOrder::INITIAL_NUM_PER_DISTRICT); - int64_t begin = clock->getMicroseconds(); - generator.makeItemsTable(tables); - for (int i = 0; i < num_warehouses; ++i) { - generator.makeWarehouse(tables, i+1); - } - int64_t end = clock->getMicroseconds(); - printf("%"PRId64" ms\n", (end-begin)/1000); - - // Change the constants for run - random = new RealRandomGenerator(); - random->setC(NURandC::makeRandomForRun(random, cLoad)); - - // Client owns all the parameters - TPCCClient client(clock, random, tables, Item::NUM_ITEMS, static_cast<int>(num_warehouses), - District::NUM_PER_WAREHOUSE, Customer::NUM_PER_DISTRICT); - printf("Running... "); - fflush(stdout); - begin = clock->getMicroseconds(); - for (int i = 0; i < 200000; ++i) { - client.doOne(); - } - end = clock->getMicroseconds(); - printf("%"PRId64" ms\n", (end-begin)/1000); - - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |