Permalink
Browse files

cleanup of migration from old crufty code

  • Loading branch information...
1 parent b97bb15 commit 6dd2f83a6ace32d9da86f53b0e8d8594d6938ee3 @ingenthr ingenthr committed Jun 20, 2009
Showing with 17 additions and 14 deletions.
  1. +2 −0 .gitignore
  2. +2 −2 Makefile.am
  3. +1 −0 libmemc.c
  4. +3 −3 main.c
  5. +2 −9 metrics.c
  6. +7 −0 metrics.h
View
@@ -16,3 +16,5 @@ config.status
libmemc.o
main.o
stamp-h1
+memcachetest
+metrics.o
View
@@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS = foreign
-bin_PROGRAMS = testclient
+bin_PROGRAMS = memcachetest
-testclient_SOURCES = main.c libmemc.c libmemc.h boxmuller.c metrics.c
+memcachetest_SOURCES = main.c libmemc.c libmemc.h boxmuller.c metrics.c
View
@@ -39,6 +39,7 @@
#include <string.h>
#include <stdio.h>
#include <assert.h>
+#include <sys/uio.h>
struct Server {
int sock;
View
6 main.c
@@ -722,7 +722,7 @@ static int test(struct report *rep) {
fflush(stderr);
}
hrtime_t delta;
- size_t size;
+ size_t size = 0;
hrtime_t start = gethrtime();
void *data = memcached_get_wrapper(connection, item.key,
item.keylen, &size);
@@ -901,7 +901,7 @@ static int load_keys(const char *fname) {
#else
keyarray = malloc(st.st_size);
- size_t offset;
+ size_t offset = 0;
ssize_t nr;
do {
nr = read(fileno(fp), keyarray + offset, st.st_size - offset);
@@ -1252,7 +1252,7 @@ int main(int argc, char **argv) {
printf("Get operations:\n");
printf(" #of ops. min max avg max90th max95th\n");
- printf("%13d", results->success_count);
+ printf("%13ld", results->success_count);
printf("%11.11s", hrtime2text(results->min_result, tmin, sizeof (tmin)));
printf("%11.11s", hrtime2text(results->max_result, tmax, sizeof (tmax)));
printf("%11.11s", hrtime2text(results->average, tavg, sizeof(tavg)));
View
@@ -69,12 +69,6 @@ struct TxnRunStatus {
};
-struct TxnResult {
- hrtime_t respTime;
- struct TxnResult* left;
- struct TxnResult* right;
-};
-
static void insert(struct TxnResult** root, struct TxnResult* item) {
if (*root == NULL) {
*root = item;
@@ -199,10 +193,9 @@ static hrtime_t calc_average(struct TxnResult* a) {
* External interface
*/
void record_tx(enum TxnType tx_type, hrtime_t time) {
- struct TxnResult new_txn { .respTme = time, .left = NULL, .right = NULL };
-
+ struct TxnResult* new_txn = calloc(1, sizeof(struct TxnResult));
pthread_mutex_lock(&lock);
- insert(&txn_list_first, create_txn(&new_txn));
+ insert(&txn_list_first, create_txn(new_txn));
pthread_mutex_unlock(&lock);
txCntStdy[tx_type]++;
}
View
@@ -68,6 +68,13 @@ void record_tx(enum TxnType, hrtime_t);
void record_error(enum TxnType, hrtime_t);
struct ResultMetrics *calc_metrics(enum TxnType tx_type);
+struct TxnResult {
+ hrtime_t respTime;
+ struct TxnResult * next;
+ struct TxnResult* left;
+ struct TxnResult* right;
+};
+
struct ResultMetrics {
hrtime_t max_result;
hrtime_t min_result;

0 comments on commit 6dd2f83

Please sign in to comment.