Skip to content

Commit ba23a41

Browse files
committed
* Version 1.2.3
* Add progress and current (instantaneous) stat
1 parent 9d7ede3 commit ba23a41

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* Version 1.2.3
2+
* Add progress and current (instantaneous) stats
3+
14
* Version 1.2.2
25
* Add --key-pattern=P:P
36
* Add -n allkeys

client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class client {
179179
public:
180180
client(client_group* group);
181181
client(struct event_base *event_base, benchmark_config *config, abstract_protocol *protocol, object_generator *obj_gen);
182-
~client();
182+
virtual ~client();
183183

184184
bool initialized(void);
185185
int prepare(void);

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
1616
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
AC_PREREQ(2.59)
19-
AC_INIT(memtier_benchmark,1.2.2,[email protected])
19+
AC_INIT(memtier_benchmark,1.2.3,[email protected])
2020
AC_CONFIG_SRCDIR([memtier_benchmark.cpp])
2121
AC_CONFIG_HEADER([config.h])
2222
AM_INIT_AUTOMAKE

memtier_benchmark.cpp

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,13 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
713713
(*i)->start();
714714
}
715715

716+
unsigned long int prev_ops = 0;
717+
unsigned long int prev_bytes = 0;
718+
unsigned long int prev_duration = 0;
719+
double prev_latency = 0, cur_latency = 0;
720+
unsigned long int cur_ops_sec = 0;
721+
unsigned long int cur_bytes_sec = 0;
722+
716723
// provide some feedback...
717724
unsigned int active_threads = 0;
718725
do {
@@ -731,10 +738,19 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
731738
total_ops += (*i)->m_cg->get_total_ops();
732739
total_bytes += (*i)->m_cg->get_total_bytes();
733740
total_latency += (*i)->m_cg->get_total_latency();
734-
if ((*i)->m_cg->get_duration_usec() > duration)
741+
if ((*i)->m_cg->get_duration_usec() > duration)
735742
duration = (*i)->m_cg->get_duration_usec();
736743
}
737744

745+
unsigned long int cur_ops = total_ops-prev_ops;
746+
unsigned long int cur_bytes = total_bytes-prev_bytes;
747+
unsigned long int cur_duration = duration-prev_duration;
748+
double cur_total_latency = total_latency-prev_latency;
749+
prev_ops = total_ops;
750+
prev_bytes = total_bytes;
751+
prev_latency = total_latency;
752+
prev_duration = duration;
753+
738754
unsigned long int ops_sec = 0;
739755
unsigned long int bytes_sec = 0;
740756
double avg_latency = 0;
@@ -743,12 +759,24 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
743759
bytes_sec = (long)( (double)total_bytes / duration * 1000000);
744760
avg_latency = ((double) total_latency / 1000 / total_ops) ;
745761
}
762+
if (cur_duration > 1000000 && active_threads == cfg->threads) {
763+
cur_ops_sec = (long)( (double)cur_ops / cur_duration * 1000000);
764+
cur_bytes_sec = (long)( (double)cur_bytes / cur_duration * 1000000);
765+
cur_latency = ((double) cur_total_latency / 1000 / cur_ops) ;
766+
}
746767

747-
char bytes_str[40];
768+
char bytes_str[40], cur_bytes_str[40];
748769
size_to_str(bytes_sec, bytes_str, sizeof(bytes_str)-1);
770+
size_to_str(cur_bytes_sec, cur_bytes_str, sizeof(cur_bytes_str)-1);
771+
772+
double progress = 0;
773+
if(cfg->requests)
774+
progress = 100.0 * total_ops / (cfg->requests*cfg->clients*cfg->threads);
775+
else
776+
progress = 100.0 * (duration / 1000000.0)/cfg->test_time;
749777

750-
fprintf(stderr, "[RUN #%u, %3u secs] %2u threads: %11lu ops, %7lu ops/sec, %s/sec, %5.2fmsec latency\r",
751-
run_id, (unsigned int) (duration / 1000000), active_threads, total_ops, ops_sec, bytes_str, avg_latency);
778+
fprintf(stderr, "[RUN #%u %.0f%%, %3u secs] %2u threads: %11lu ops, %7lu (avg: %7lu) ops/sec, %s/sec (avg: %s/sec), %5.2f (avg: %5.2f) msec latency\r",
779+
run_id, progress, (unsigned int) (duration / 1000000), active_threads, total_ops, cur_ops_sec, ops_sec, cur_bytes_str, bytes_str, cur_latency, avg_latency);
752780
} while (active_threads > 0);
753781

754782
fprintf(stderr, "\n\n");

0 commit comments

Comments
 (0)