From 847b2ec9ad417cfdbb7e31878bcb670d56660427 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 23 Sep 2013 14:19:49 +0100 Subject: [PATCH] status: Remove useless stats --- src/status.c | 7 ----- src/status.h | 17 ++---------- tests/unit/check_status.c | 56 --------------------------------------- 3 files changed, 2 insertions(+), 78 deletions(-) diff --git a/src/status.c b/src/status.c index 17a78cc..aa9f8c2 100644 --- a/src/status.c +++ b/src/status.c @@ -19,10 +19,6 @@ struct status * status_create( struct server * serve ) status->is_mirroring = NULL != serve->mirror; if ( status->is_mirroring ) { - status->migration_pass = serve->mirror->pass; - status->pass_dirty_bytes = serve->mirror->this_pass_dirty; - status->pass_clean_bytes = serve->mirror->this_pass_clean; - status->migration_duration = monotonic_time_ms(); if ( ( serve->mirror->migration_started ) < status->migration_duration ) { @@ -61,9 +57,6 @@ int status_write( struct status * status, int fd ) PRINT_BOOL( has_control ); if ( status->is_mirroring ) { - PRINT_INT( migration_pass ); - PRINT_UINT64( pass_dirty_bytes ); - PRINT_UINT64( pass_clean_bytes ); PRINT_UINT64( migration_speed ); PRINT_UINT64( migration_duration ); PRINT_UINT64( migration_seconds_left ); diff --git a/src/status.h b/src/status.h index 925ec99..a927922 100644 --- a/src/status.h +++ b/src/status.h @@ -57,18 +57,8 @@ * Network transfer speed, in bytes/second. This only takes dirty bytes * into account. * - * migration_pass: - * When migrating, we perform a number of passes over the file. This indicates - * the current pass. - * - * pass_dirty_bytes: - * For the current pass, how many dirty bytes have we found so far? These are - * classed as bytes that we are required to send to the destination. - * - * pass_clean_bytes: - * For the current pass, how many clean bytes? These are bytes we don't need - * to send to the destination. Once all the bytes are clean, the migration is - * done. + * migration_speed_limit: + * If set, the speed we're going to try to limit the migration to. * * migration_seconds_left: * Our current best estimate of how many seconds are left before the migration @@ -89,9 +79,6 @@ struct status { int clients_allowed; int num_clients; int is_mirroring; - int migration_pass; - uint64_t pass_dirty_bytes; - uint64_t pass_clean_bytes; uint64_t migration_duration; uint64_t migration_speed; diff --git a/tests/unit/check_status.c b/tests/unit/check_status.c index 3e4586b..81f79be 100644 --- a/tests/unit/check_status.c +++ b/tests/unit/check_status.c @@ -124,26 +124,6 @@ START_TEST( test_gets_num_clients ) } END_TEST -START_TEST( test_gets_migration_pass ) -{ - struct server * server = mock_server(); - struct status * status = status_create( server ); - - fail_if( status->migration_pass != 0, "migration_pass was set" ); - status_destroy( status ); - destroy_mock_server( server ); - - server = mock_mirroring_server(); - server->mirror->pass = 1; - status = status_create( server ); - - fail_unless( status->migration_pass == 1, "migration_pass wasn't set" ); - status_destroy( status ); - destroy_mock_server( server ); -} -END_TEST - - START_TEST( test_gets_pid ) { struct server * server = mock_server(); @@ -173,8 +153,6 @@ END_TEST START_TEST( test_gets_migration_statistics ) { struct server * server = mock_mirroring_server(); - server->mirror->this_pass_clean = 2048; - server->mirror->this_pass_dirty = 4096; server->mirror->all_dirty = 16384; server->mirror->max_bytes_per_second = 32768; server->mirror->offset = 0; @@ -184,9 +162,6 @@ START_TEST( test_gets_migration_statistics ) struct status * status = status_create( server ); - fail_unless( 2048 == status->pass_clean_bytes, "pass_clean_bytes wasn't gathered" ); - fail_unless( 4096 == status->pass_dirty_bytes, "pass_dirty_bytes wasn't gathered" ); - fail_unless ( 0 == status->migration_duration || 1 == status->migration_duration || @@ -324,39 +299,16 @@ START_TEST( test_renders_size ) } END_TEST -START_TEST( test_renders_migration_pass ) -{ - RENDER_TEST_SETUP - - status.is_mirroring = 0; - status.migration_pass = 1; - status_write( &status, fds[1] ); - fail_if_rendered( fds[0], "migration_pass" ); - - status.is_mirroring = 1; - status_write( &status, fds[1] ); - fail_unless_rendered( fds[0], "migration_pass=1" ); -} -END_TEST - START_TEST( test_renders_migration_statistics ) { RENDER_TEST_SETUP status.is_mirroring = 0; - status.pass_dirty_bytes = 2048; - status.pass_clean_bytes = 4096; status.migration_duration = 8; status.migration_speed = 40000000; status.migration_speed_limit = 40000001; status.migration_seconds_left = 1; - status_write( &status, fds[1] ); - fail_if_rendered( fds[0], "pass_dirty_bytes" ); - - status_write( &status, fds[1] ); - fail_if_rendered( fds[0], "pass_clean_bytes" ); - status_write( &status, fds[1] ); fail_if_rendered( fds[0], "migration_duration" ); @@ -371,12 +323,6 @@ START_TEST( test_renders_migration_statistics ) status.is_mirroring = 1; - status_write( &status, fds[1] ); - fail_unless_rendered( fds[0], "pass_dirty_bytes=2048" ); - - status_write( &status, fds[1] ); - fail_unless_rendered( fds[0], "pass_clean_bytes=4096" ); - status_write( &status, fds[1] ); fail_unless_rendered( fds[0], "migration_duration=8" ); @@ -410,7 +356,6 @@ Suite *status_suite(void) tcase_add_test(tc_create, test_gets_num_clients); tcase_add_test(tc_create, test_gets_pid); tcase_add_test(tc_create, test_gets_size); - tcase_add_test(tc_create, test_gets_migration_pass); tcase_add_test(tc_create, test_gets_migration_statistics); @@ -420,7 +365,6 @@ Suite *status_suite(void) tcase_add_test(tc_render, test_renders_num_clients); tcase_add_test(tc_render, test_renders_pid); tcase_add_test(tc_render, test_renders_size); - tcase_add_test(tc_render, test_renders_migration_pass); tcase_add_test(tc_render, test_renders_migration_statistics); suite_add_tcase(s, tc_create);