test_fsync.diff

text/x-diff

Filename: test_fsync.diff
Type: text/x-diff
Part: 0
Message: pg_test_fsync performance

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
contrib/pg_test_fsync/pg_test_fsync.c 0 0
diff --git a/contrib/pg_test_fsync/pg_test_fsync.c b/contrib/pg_test_fsync/pg_test_fsync.c
new file mode 100644
index 042b02b..970deda
*** a/contrib/pg_test_fsync/pg_test_fsync.c
--- b/contrib/pg_test_fsync/pg_test_fsync.c
*************** test_open_syncs(void)
*** 358,368 ****
  	printf("(This is designed to compare the cost of writing 16kB\n");
  	printf("in different write open_sync sizes.)\n");
  
! 	test_open_sync("16kB open_sync write", 16);
! 	test_open_sync(" 8kB open_sync writes", 8);
! 	test_open_sync(" 4kB open_sync writes", 4);
! 	test_open_sync(" 2kB open_sync writes", 2);
! 	test_open_sync(" 1kB open_sync writes", 1);
  }
  
  /*
--- 358,368 ----
  	printf("(This is designed to compare the cost of writing 16kB\n");
  	printf("in different write open_sync sizes.)\n");
  
! 	test_open_sync(" 1 * 16kB open_sync write", 16);
! 	test_open_sync(" 2 *  8kB open_sync writes", 8);
! 	test_open_sync(" 4 *  4kB open_sync writes", 4);
! 	test_open_sync(" 8 *  2kB open_sync writes", 2);
! 	test_open_sync("16 *  1kB open_sync writes", 1);
  }
  
  /*
*************** test_open_sync(const char *msg, int writ
*** 376,381 ****
--- 376,385 ----
  				ops,
  				writes;
  #endif
+ 	int	save_ops_per_test = ops_per_test;
+ 
+ 	/* This test can be long, so scale down the number of tests */
+ 	ops_per_test = ops_per_test * writes_size / 16;
  
  	printf(LABEL_FORMAT, msg);
  	fflush(stdout);
*************** test_open_sync(const char *msg, int writ
*** 402,407 ****
--- 406,412 ----
  #else
  	printf(NA_FORMAT, "n/a\n");
  #endif
+ 	ops_per_test = save_ops_per_test;
  }
  
  static void