BIND 10 trac2040, updated. 3c23e2fd8ecc4cf1f52f40d929c4846b7b243b4f [2040] Minor changes to layout and comments

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Jul 23 13:00:06 UTC 2012


The branch, trac2040 has been updated
       via  3c23e2fd8ecc4cf1f52f40d929c4846b7b243b4f (commit)
      from  7e2b5f37a32c3772e9b79c59ac03ba06b9f5e880 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3c23e2fd8ecc4cf1f52f40d929c4846b7b243b4f
Author: Stephen Morris <stephen at isc.org>
Date:   Mon Jul 23 13:58:24 2012 +0100

    [2040] Minor changes to layout and comments

-----------------------------------------------------------------------

Summary of changes:
 tests/tools/dhcp-ubench/Makefile          |   20 +++++++++------
 tests/tools/dhcp-ubench/benchmark.cc      |   20 +++++++--------
 tests/tools/dhcp-ubench/memfile_ubench.cc |   32 +++++++++++------------
 tests/tools/dhcp-ubench/mysql_ubench.cc   |   39 ++++++++++++++--------------
 tests/tools/dhcp-ubench/mysql_ubench.h    |    2 +-
 tests/tools/dhcp-ubench/sqlite_ubench.cc  |   40 ++++++++++++++---------------
 6 files changed, 78 insertions(+), 75 deletions(-)

-----------------------------------------------------------------------
diff --git a/tests/tools/dhcp-ubench/Makefile b/tests/tools/dhcp-ubench/Makefile
index f5f84fe..df902d2 100644
--- a/tests/tools/dhcp-ubench/Makefile
+++ b/tests/tools/dhcp-ubench/Makefile
@@ -1,9 +1,13 @@
-MYSQL_CFLAGS=`mysql_config --cflags`
-MYSQL_LDFLAGS=`mysql_config --libs`
 CFLAGS=-g -O0 -Wall -pedantic -Wextra
 LDFLAGS=-lrt
 
-SQLITE_CFLAGS=`pkg-config sqlite3 --cflags` $(LDFLAGS)
+MEMFILE_CFLAGS=
+MEMFILE_LDFLAGS=
+
+MYSQL_CFLAGS=`mysql_config --cflags`
+MYSQL_LDFLAGS=`mysql_config --libs`
+
+SQLITE_CFLAGS=`pkg-config sqlite3 --cflags`
 SQLITE_LDFLAGS=`pkg-config sqlite3 --libs`
 
 all: mysql_ubench sqlite_ubench memfile_ubench
@@ -17,19 +21,19 @@ benchmark.o: benchmark.cc benchmark.h
 	$(CXX) $< -c $(CFLAGS) $(MYSQL_CFLAGS)
 
 mysql_ubench: mysql_ubench.o benchmark.o
-	$(CXX) $< benchmark.o -o mysql_ubench $(CFLAGS) $(MYSQL_CFLAGS) $(MYSQL_LDFLAGS)
+	$(CXX) $< benchmark.o -o mysql_ubench $(CFLAGS) $(MYSQL_CFLAGS) $(LDFLAGS) $(MYSQL_LDFLAGS)
 
 sqlite_ubench.o: sqlite_ubench.cc sqlite_ubench.h
 	$(CXX) $< -c $(CFLAGS) $(SQLLITE_CFLAGS)
 
 sqlite_ubench: sqlite_ubench.o benchmark.o
-	$(CXX) $< benchmark.o -o sqlite_ubench $(CFLAGS) $(SQLITE_CFLAGS) $(SQLITE_LDFLAGS)
+	$(CXX) $< benchmark.o -o sqlite_ubench $(CFLAGS) $(SQLITE_CFLAGS) $(LDFLAGS) $(SQLITE_LDFLAGS)
 
 memfile_ubench.o: memfile_ubench.cc memfile_ubench.h
-	$(CXX) $< -c $(CFLAGS) $(SQLLITE_CFLAGS)
+	$(CXX) $< -c $(CFLAGS) $(MEMFILE_CFLAGS)
 
 memfile_ubench: memfile_ubench.o benchmark.o
-	$(CXX) $< benchmark.o -o memfile_ubench $(LDFLAGS)
+	$(CXX) $< benchmark.o -o memfile_ubench $(LDFLAGS) $(MEMFILE_LDFLAGS)
 
 clean:
 	rm -f mysql_ubench sqlite_ubench memfile_ubench *.o
@@ -48,4 +52,4 @@ dhcp-perf-guide.html: dhcp-perf-guide.xml version.ent
 		dhcp-perf-guide.xml
 
 dhcp-perf-guide.pdf: dhcp-perf-guide.xml
-	docbook2pdf $<
\ No newline at end of file
+	docbook2pdf $<
diff --git a/tests/tools/dhcp-ubench/benchmark.cc b/tests/tools/dhcp-ubench/benchmark.cc
index c74ef0e..663d158 100644
--- a/tests/tools/dhcp-ubench/benchmark.cc
+++ b/tests/tools/dhcp-ubench/benchmark.cc
@@ -76,14 +76,14 @@ bool uBenchmark::parseCmdline(int argc, char* const argv[]) {
             }
             break;
         case 's':
-            if (!strcasecmp(optarg, "yes") || !strcmp(optarg,"1")) {
+            if (!strcasecmp(optarg, "yes") || !strcmp(optarg, "1")) {
                 Sync_ = true;
             } else {
                 Sync_ = false;
             }
             break;
         case 'v':
-            if (!strcasecmp(optarg, "yes") || !strcmp(optarg,"1")) {
+            if (!strcasecmp(optarg, "yes") || !strcmp(optarg, "1")) {
                 Verbose_ = true;
             } else {
                 Verbose_ = false;
@@ -125,14 +125,14 @@ void uBenchmark::print_clock(const std::string& operation, uint32_t num,
 
 int uBenchmark::run() {
 
-    cout << "Starting test. Parameters: " << endl
-         << "Number of iterations :" << Num_ << endl
-         << "Sync/async           :" << (Sync_?"sync":"async") << endl
-         << "Verbose              :" << (Verbose_?"verbose":"quiet") << endl
-         << "Database name        :" << DBName_ << endl
-         << "MySQL hostname       :" << Hostname_ << endl
-         << "MySQL username       :" << User_ << endl
-         << "MySQL password       :" << Passwd_ << endl << endl;
+    cout << "Starting test. Parameters:" << endl
+         << "Number of iterations : " << Num_ << endl
+         << "Sync/async           : " << (Sync_ ? "sync" : "async") << endl
+         << "Verbose              : " << (Verbose_ ? "verbose" : "quiet") << endl
+         << "Database name        : " << DBName_ << endl
+         << "MySQL hostname       : " << Hostname_ << endl
+         << "MySQL username       : " << User_ << endl
+         << "MySQL password       : " << Passwd_ << endl << endl;
 
 
     srandom(time(NULL));
diff --git a/tests/tools/dhcp-ubench/memfile_ubench.cc b/tests/tools/dhcp-ubench/memfile_ubench.cc
index b0fac27..7bb47ae 100644
--- a/tests/tools/dhcp-ubench/memfile_ubench.cc
+++ b/tests/tools/dhcp-ubench/memfile_ubench.cc
@@ -139,7 +139,6 @@ void memfile_uBenchmark::failure(const char* operation) {
 void memfile_uBenchmark::connect() {
     try {
         LeaseMgr_ = new memfile_LeaseMgr(Filename_, Sync_);
-
     } catch (const std::string& e) {
         failure(e.c_str());
     }
@@ -155,34 +154,34 @@ void memfile_uBenchmark::createLease4Test() {
         throw "No LeaseMgr instantiated.";
     }
 
-    uint32_t addr = BASE_ADDR4; // Let's start with 1.0.0.0 address
-    const uint8_t hwaddr_len = 20; // not a real field
+    uint32_t addr = BASE_ADDR4;     // Let's start with 1.0.0.0 address
+    const uint8_t hwaddr_len = 20;  // Not a real field
     char hwaddr_tmp[hwaddr_len];
     const uint8_t client_id_len = 128;
     char client_id_tmp[client_id_len];
-    uint32_t valid_lft = 1000;  // we can use the same value for all leases
-    uint32_t recycle_time = 0;  // not supported in any foresable future,
-                                // so keep this as 0
-    time_t cltt = time(NULL); // timestamp
-    uint32_t pool_id = 0; // let's use pools 0-99
-    bool fixed = false;   //
-    string hostname("foo");      // will generate it dynamically
-    bool fqdn_fwd = true; // let's pretend to do AAAA update
-    bool fqdn_rev = true; // let's pretend to do PTR update
+    uint32_t valid_lft = 1000;      // We can use the same value for all leases
+    uint32_t recycle_time = 0;      // Not supported in any foreseeable future,
+                                    //     so keep this as 0
+    time_t cltt = time(NULL);       // Timestamp
+    uint32_t pool_id = 0;           // Let's use pools 0-99
+    bool fixed = false;
+    string hostname("foo");         // Will generate it dynamically
+    bool fqdn_fwd = true;           // Let's pretend to do AAAA update
+    bool fqdn_rev = true;           // Let's pretend to do PTR update
 
     printf("CREATE:   ");
 
-    // while we could put the data directly into vector, I would like to
+    // While we could put the data directly into vector, I would like to
     // keep the code as  similar to other benchmarks as possible
     for (uint8_t i = 0; i < hwaddr_len; i++) {
         hwaddr_tmp[i] = 65 + i;
     }
-    vector<uint8_t> hwaddr(hwaddr_tmp, hwaddr_tmp+19);
+    vector<uint8_t> hwaddr(hwaddr_tmp, hwaddr_tmp + 19);
 
     for (uint8_t i = 0; i < client_id_len; i++) {
         client_id_tmp[i] = 33 + i;
     }
-    vector<uint8_t> client_id(client_id_tmp, client_id_tmp+19);
+    vector<uint8_t> client_id(client_id_tmp, client_id_tmp + 19);
 
     for (uint32_t i = 0; i < Num_; i++) {
 
@@ -219,13 +218,12 @@ void memfile_uBenchmark::searchLease4Test() {
         throw "No LeaseMgr instantiated.";
     }
 
-    // this formula should roughly find something a lease in 90% cases
+    // This formula should roughly find something a lease in 90% cases
     float hitRatio = 0.5;
 
     printf("RETRIEVE: ");
 
     for (uint32_t i = 0; i < Num_; i++) {
-
         uint32_t x = BASE_ADDR4 + random() % int(Num_ / hitRatio);
 
         Lease4Ptr lease = LeaseMgr_->getLease(x);
diff --git a/tests/tools/dhcp-ubench/mysql_ubench.cc b/tests/tools/dhcp-ubench/mysql_ubench.cc
index d3d8b4c..7fdda24 100644
--- a/tests/tools/dhcp-ubench/mysql_ubench.cc
+++ b/tests/tools/dhcp-ubench/mysql_ubench.cc
@@ -89,18 +89,18 @@ void MySQL_uBenchmark::createLease4Test() {
 
     uint32_t addr = BASE_ADDR4; // Let's start with 1.0.0.0 address
     char hwaddr[20];
-    uint8_t hwaddr_len = 20; // not a real field
+    uint8_t hwaddr_len = 20;    // Not a real field
     char client_id[128];
     uint8_t client_id_len = 128;
-    uint32_t valid_lft = 1000;  // we can use the same value for all leases
-    uint32_t recycle_time = 0;  // not supported in any foresable future,
-                                // so keep this as 0
-    string cltt = "now()"; // timestamp
-    uint32_t pool_id = 0; // let's use pools 0-99
-    bool fixed = false;   //
-    string hostname("foo");      // will generate it dynamically
-    bool fqdn_fwd = true; // let's pretend to do AAAA update
-    bool fqdn_rev = true; // let's pretend to do PTR update
+    uint32_t valid_lft = 1000;  // We can use the same value for all leases
+    uint32_t recycle_time = 0;  //    not supported in any foresable future,
+                                //    so keep this as 0
+    string cltt = "now()";      // Timestamp
+    uint32_t pool_id = 0;       // Let's use pools 0-99
+    bool fixed = false;
+    string hostname("foo");     // Will generate it dynamically
+    bool fqdn_fwd = true;       // Let's pretend to do AAAA update
+    bool fqdn_rev = true;       // Let's pretend to do PTR update
 
     printf("CREATE:   ");
 
@@ -228,8 +228,9 @@ void MySQL_uBenchmark::updateLease4Test() {
         sprintf(query, "UPDATE lease4 SET valid_lft=1002, cltt=now() WHERE addr=%d", x);
         mysql_real_query(Conn_, query, strlen(query));
 
-        if (Verbose_)
+        if (Verbose_) {
             printf(".");
+        }
     }
 
     printf("\n");
@@ -265,17 +266,17 @@ void MySQL_uBenchmark::printInfo() {
 
 int main(int argc, char * const argv[]) {
 
-    const char * hostname ="localhost"; // -m (MySQL server)
-    const char * user = "root";  // -u
-    const char * passwd = "secret"; // -p
-    const char * dbname = "kea"; // -f
-    uint32_t num = 100; // -n
-    bool sync = true;  // -s
-    bool verbose = true; // -v
+    const char* hostname ="localhost";  // -m (MySQL server)
+    const char* user = "root";          // -u
+    const char* passwd = "secret";      // -p
+    const char* dbname = "kea";         // -f
+    uint32_t num = 100;                 // -n
+    bool sync = true;                   // -s
+    bool verbose = true;                // -v
 
     MySQL_uBenchmark bench(hostname, user, passwd, dbname, num, sync, verbose);
 
-   bench.parseCmdline(argc, argv);
+    bench.parseCmdline(argc, argv);
 
     int result = bench.run();
 
diff --git a/tests/tools/dhcp-ubench/mysql_ubench.h b/tests/tools/dhcp-ubench/mysql_ubench.h
index ce4fa4b..c2c33d4 100644
--- a/tests/tools/dhcp-ubench/mysql_ubench.h
+++ b/tests/tools/dhcp-ubench/mysql_ubench.h
@@ -33,5 +33,5 @@ public:
 protected:
     void failure(const char* operation);
 
-    MYSQL * Conn_;
+    MYSQL* Conn_;
 };
diff --git a/tests/tools/dhcp-ubench/sqlite_ubench.cc b/tests/tools/dhcp-ubench/sqlite_ubench.cc
index a2d93b3..9974a3c 100644
--- a/tests/tools/dhcp-ubench/sqlite_ubench.cc
+++ b/tests/tools/dhcp-ubench/sqlite_ubench.cc
@@ -68,20 +68,20 @@ void SQLite_uBenchmark::createLease4Test() {
         throw "SQLite connection is closed.";
     }
 
-    uint32_t addr = BASE_ADDR4; // Let's start with 1.0.0.0 address
-    const uint8_t hwaddr_len = 20; // not a real field
+    uint32_t addr = BASE_ADDR4;     // Let's start with 1.0.0.0 address
+    const uint8_t hwaddr_len = 20;  // Not a real field
     char hwaddr[hwaddr_len];
     const uint8_t client_id_len = 128;
     char client_id[client_id_len];
-    uint32_t valid_lft = 1000;  // we can use the same value for all leases
-    uint32_t recycle_time = 0;  // not supported in any foresable future,
-                                // so keep this as 0
-    string cltt = "now"; // timestamp
-    uint32_t pool_id = 0; // let's use pools 0-99
-    bool fixed = false;   //
-    string hostname("foo");      // will generate it dynamically
-    bool fqdn_fwd = true; // let's pretend to do AAAA update
-    bool fqdn_rev = true; // let's pretend to do PTR update
+    uint32_t valid_lft = 1000;      // We can use the same value for all leases
+    uint32_t recycle_time = 0;      // Not supported in any foresable future,
+                                    //     so keep this as 0
+    string cltt = "now";            // Timestamp
+    uint32_t pool_id = 0;           // Let's use pools 0-99
+    bool fixed = false;
+    string hostname("foo");         // Will generate it dynamically
+    bool fqdn_fwd = true;           // Let's pretend to do AAAA update
+    bool fqdn_rev = true;           // Let's pretend to do PTR update
 
     printf("CREATE:   ");
 
@@ -103,7 +103,7 @@ void SQLite_uBenchmark::createLease4Test() {
         cltt << "2012-07-11 15:43:" << (i % 60);
 
         addr++;
-        char * errorMsg = NULL;
+        char* errorMsg = NULL;
 
         // the first address is 1.0.0.0.
         char query[2000];
@@ -132,10 +132,10 @@ void SQLite_uBenchmark::createLease4Test() {
     printf("\n");
 }
 
-static int search_callback(void *counter, int /*argc*/, char **/*argv*/, 
-                           char **/*azColName*/){
+static int search_callback(void *counter, int /*argc*/, char** /*argv*/, 
+                           char** /*azColName*/){
 
-    int * cnt = static_cast<int*>(counter);
+    int* cnt = static_cast<int*>(counter);
     (*cnt)++;
 
 #if 0
@@ -162,7 +162,7 @@ void SQLite_uBenchmark::searchLease4Test() {
 
         uint32_t x = BASE_ADDR4 + random() % int(Num_ / hitRatio);
 
-        char * errorMsg = NULL;
+        char* errorMsg = NULL;
 
         int cnt = 0;
 
@@ -203,7 +203,7 @@ void SQLite_uBenchmark::updateLease4Test() {
 
         uint32_t x = BASE_ADDR4 + random() % Num_;
 
-        char * errorMsg = NULL;
+        char* errorMsg = NULL;
         char query[2000];
         sprintf(query, "UPDATE lease4 SET valid_lft=1002, cltt='now' WHERE addr=%d", x);
 
@@ -231,7 +231,7 @@ void SQLite_uBenchmark::deleteLease4Test() {
     for (uint32_t i = 0; i < Num_; i++) {
 
         uint32_t x = BASE_ADDR4 + i;
-        char * errorMsg = NULL;
+        char* errorMsg = NULL;
 
         char query[2000];
         sprintf(query, "DELETE FROM lease4 WHERE addr=%d", x);
@@ -256,9 +256,9 @@ void SQLite_uBenchmark::printInfo() {
 
 
 
-int main(int argc, char * const argv[]) {
+int main(int argc, char* const argv[]) {
 
-    const char * filename = "sqlite.db";
+    const char* filename = "sqlite.db";
     uint32_t num = 100;
     bool sync = true;
     bool verbose = true;



More information about the bind10-changes mailing list