diff options
| author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2012-02-01 09:32:02 +1100 |
|---|---|---|
| committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2012-02-01 09:32:02 +1100 |
| commit | 0d084a9bfa38793d0502429ee280772c5d2fc22b (patch) | |
| tree | 845c8ef670cbd4dbfd7961f0b6f92916ef98d293 | |
| parent | 65e1e1d3ef48bd583fbe00d746706b9a028e1dc5 (diff) | |
| download | samba-0d084a9bfa38793d0502429ee280772c5d2fc22b.tar.gz samba-0d084a9bfa38793d0502429ee280772c5d2fc22b.tar.xz samba-0d084a9bfa38793d0502429ee280772c5d2fc22b.zip | |
ReadOnly: update the loop test tool to print number of fetches per second
(This used to be ctdb commit f53c66a5e0dc5351b86b81dc5b1faea757981d4c)
| -rw-r--r-- | ctdb/tests/src/ctdb_fetch_readonly_loop.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ctdb/tests/src/ctdb_fetch_readonly_loop.c b/ctdb/tests/src/ctdb_fetch_readonly_loop.c index 12540188bc..d2bf525a9a 100644 --- a/ctdb/tests/src/ctdb_fetch_readonly_loop.c +++ b/ctdb/tests/src/ctdb_fetch_readonly_loop.c @@ -18,6 +18,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include <time.h> #include "includes.h" #include "lib/tevent/tevent.h" #include "system/filesys.h" @@ -38,6 +39,7 @@ static void fetch_lock_once(struct ctdb_context *ctdb, struct event_context *ev) TALLOC_CTX *tmp_ctx = talloc_new(ctdb); TDB_DATA key, data; struct ctdb_record_handle *h; + static time_t t = 0, t2; key.dptr = discard_const(TESTKEY); key.dsize = strlen(TESTKEY); @@ -53,7 +55,15 @@ static void fetch_lock_once(struct ctdb_context *ctdb, struct event_context *ev) } count++; - printf("%d data:%.*s\n", (int)count, (int)data.dsize, data.dptr); + t2 = time(NULL); + if (t != 0 && t != t2) { + static int last_count = 0; + + printf("count : %d\n", count - last_count); + last_count = count; + } + t = t2; + talloc_free(tmp_ctx); } @@ -127,7 +137,6 @@ int main(int argc, const char *argv[]) while (1) { fetch_lock_once(ctdb, ev); - usleep(10000); } return 0; |
