Recent changes (gfio)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit 1e5324e723116a5faf9da686993cc79c14d62d4b:

  Merge branch 'master' into gfio (2012-11-14 14:25:31 -0700)

are available in the git repository at:

  git://git.kernel.dk/fio.git gfio

Jens Axboe (3):
      server: properly reset stat_number in fio_reset_state()
      server: properly reset state_number in fio_reset_state()
      Merge branch 'master' into gfio

Vincent Kang Fu (1):
      t/genzfip: add -c option for csv output

 libfio.c    |    1 +
 server.c    |    4 --
 t/genzipf.c |  147 +++++++++++++++++++++++++++++++++--------------------------
 3 files changed, 84 insertions(+), 68 deletions(-)

---

Diff of recent changes:

diff --git a/libfio.c b/libfio.c
index f680be8..b48d7c2 100644
--- a/libfio.c
+++ b/libfio.c
@@ -135,6 +135,7 @@ void reset_fio_state(void)
 {
 	groupid = 0;
 	thread_number = 0;
+	stat_number = 0;
 	done_secs = 0;
 }
 
diff --git a/server.c b/server.c
index 6447591..8d7f9b7 100644
--- a/server.c
+++ b/server.c
@@ -561,8 +561,6 @@ static int handle_job_cmd(struct fio_net_cmd *cmd)
 	pdu->buf_len = le32_to_cpu(pdu->buf_len);
 	pdu->client_type = le32_to_cpu(pdu->client_type);
 
-	stat_number = 0;
-
 	if (parse_jobs_ini(buf, 1, 0, pdu->client_type)) {
 		fio_net_send_quit(server_fd);
 		return -1;
@@ -600,8 +598,6 @@ static int handle_jobline_cmd(struct fio_net_cmd *cmd)
 		dprint(FD_NET, "server: %d: %s\n", i, argv[i]);
 	}
 
-	stat_number = 0;
-
 	if (parse_cmd_line(clp->lines, argv, clp->client_type)) {
 		fio_net_send_quit(server_fd);
 		free(argv);
diff --git a/t/genzipf.c b/t/genzipf.c
index 2d1b107..3cc93e6 100644
--- a/t/genzipf.c
+++ b/t/genzipf.c
@@ -21,7 +21,6 @@
 #include "../lib/zipf.h"
 #include "../flist.h"
 #include "../hash.h"
-#include "../rbtree.h"
 
 #define DEF_NR		1000000
 #define DEF_NR_OUTPUT	23
@@ -49,6 +48,7 @@ static unsigned long block_size = 4096;
 static unsigned long output_nranges = DEF_NR_OUTPUT;
 static double percentage;
 static double dist_val;
+static int output_csv = 0;
 
 #define DEF_ZIPF_VAL	1.2
 #define DEF_PARETO_VAL	0.3
@@ -80,7 +80,7 @@ static struct node *hash_insert(struct node *n, unsigned long long val)
 
 static int parse_options(int argc, char *argv[])
 {
-	const char *optstring = "t:g:i:o:b:p:";
+	const char *optstring = "t:g:i:o:b:p:c";
 	int c, dist_val_set = 0;
 
 	while ((c = getopt(argc, argv, optstring)) != -1) {
@@ -111,6 +111,9 @@ static int parse_options(int argc, char *argv[])
 		case 'o':
 			output_nranges = strtoul(optarg, NULL, 10);
 			break;
+		case 'c':
+			output_csv = 1;
+			break;
 		default:
 			printf("bad option %c\n", c);
 			return 1;
@@ -162,7 +165,8 @@ int main(int argc, char *argv[])
 	if (parse_options(argc, argv))
 		return 1;
 
-	printf("Generating %s distribution with %f input and %lu GB size and %lu block_size.\n", dist_types[dist_type], dist_val, gb_size, block_size);
+	if( !output_csv )
+		printf("Generating %s distribution with %f input and %lu GB size and %lu block_size.\n", dist_types[dist_type], dist_val, gb_size, block_size);
 
 	nranges = gb_size * 1024 * 1024 * 1024ULL;
 	nranges /= block_size;
@@ -208,80 +212,95 @@ int main(int argc, char *argv[])
 	nnodes = j;
 	nr_vals = nnodes;
 
-	interval = (nr_vals + output_nranges - 1) / output_nranges;
-
-	output_sums = malloc(output_nranges * sizeof(struct output_sum));
-	for (i = 0; i < output_nranges; i++) {
-		output_sums[i].output = 0.0;
-		output_sums[i].nranges = 1;
-	}
-
-	total_vals = i = j = cur_vals = 0;
-	
-	for (k = 0; k < nnodes; k++) {
-		struct output_sum *os = &output_sums[j];
-		struct node *node = &nodes[k];
-
-		if (i >= interval) {
-			os->output = (double) (cur_vals + 1) / (double) nranges;
-			os->output *= 100.0;
-			j++;
-			cur_vals = node->hits;
-			interval += (nr_vals + output_nranges - 1) / output_nranges;
-		} else {
-			cur_vals += node->hits;
-			os->nranges += node->hits;
+	if (output_csv) {
+		printf("rank, count\n");
+		for (k = 0; k < nnodes; k++)
+			printf("%lu, %lu\n", k, nodes[k].hits);
+	} else {
+		interval = (nr_vals + output_nranges - 1) / output_nranges;
+
+		output_sums = malloc(output_nranges * sizeof(struct output_sum));
+		for (i = 0; i < output_nranges; i++) {
+			output_sums[i].output = 0.0;
+			output_sums[i].nranges = 1;
 		}
 
-		i++;
-		total_vals += node->hits;
-
-		if (percentage) {
-			unsigned long blocks = percentage * nranges / 100;
-
-			if (total_vals >= blocks) {
-				double cs = i * block_size / (1024 * 1024);
-				char p = 'M';
+		total_vals = i = j = cur_vals = 0;
+
+		for (k = 0; k < nnodes; k++) {
+			struct output_sum *os = &output_sums[j];
+			struct node *node = &nodes[k];
+
+			if (i >= interval) {
+				os->output =
+				    (double)(cur_vals + 1) / (double)nranges;
+				os->output *= 100.0;
+				j++;
+				cur_vals = node->hits;
+				interval +=
+				    (nr_vals + output_nranges -
+				     1) / output_nranges;
+			} else {
+				cur_vals += node->hits;
+				os->nranges += node->hits;
+			}
 
-				if (cs > 1024.0) {
-					cs /= 1024.0;
-					p = 'G';
-				}
-				if (cs > 1024.0) {
-					cs /= 1024.0;
-					p = 'T';
+			i++;
+			total_vals += node->hits;
+
+			if (percentage) {
+				unsigned long blocks =
+				    percentage * nranges / 100;
+
+				if (total_vals >= blocks) {
+					double cs =
+					    i * block_size / (1024 * 1024);
+					char p = 'M';
+
+					if (cs > 1024.0) {
+						cs /= 1024.0;
+						p = 'G';
+					}
+					if (cs > 1024.0) {
+						cs /= 1024.0;
+						p = 'T';
+					}
+
+					printf("%.2f%% of hits satisfied in %.3f%cB of cache\n", percentage, cs, p);
+					percentage = 0.0;
 				}
-
-				printf("%.2f%% of hits satisfied in %.3f%cB of cache\n", percentage, cs, p);
-				percentage = 0.0;
 			}
 		}
-	}
 
-	perc_i = 100.0 / (double) output_nranges;
-	perc = 0.0;
+		perc_i = 100.0 / (double)output_nranges;
+		perc = 0.0;
 
-	printf("\n   Rows           Hits           No Hits         Size\n");
-	printf("--------------------------------------------------------\n");
-	for (i = 0; i < j; i++) {
-		struct output_sum *os = &output_sums[i];
-		double gb = (double) os->nranges * block_size / 1024.0;
-		char p = 'K';
+		printf("\n   Rows           Hits           No Hits         Size\n");
+		printf("--------------------------------------------------------\n");
+		for (i = 0; i < j; i++) {
+			struct output_sum *os = &output_sums[i];
+			double gb = (double)os->nranges * block_size / 1024.0;
+			char p = 'K';
 
-		if (gb > 1024.0) {
-			p = 'M';
-			gb /= 1024.0;
-		}
-		if (gb > 1024.0) {
-			p = 'G';
-			gb /= 1024.0;
+			if (gb > 1024.0) {
+				p = 'M';
+				gb /= 1024.0;
+			}
+			if (gb > 1024.0) {
+				p = 'G';
+				gb /= 1024.0;
+			}
+
+			perc += perc_i;
+			printf("%s %6.2f%%\t%6.2f%%\t\t%8u\t%6.2f%c\n",
+			       i ? "|->" : "Top", perc, os->output, os->nranges,
+			       gb, p);
 		}
 
-		perc += perc_i;
-		printf("%s %6.2f%%\t%6.2f%%\t\t%8u\t%6.2f%c\n", i ? "|->" : "Top", perc, os->output, os->nranges, gb, p);
+		free(output_sums);
 	}
 
-	free(output_sums);
 	free(hash);
+	free(nodes);
 	return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux