title: Getting periodic stats from redis
body: <p>Is there a similar command in <strong>redis</strong> like <code>stats</code> in <strong>memcached</strong> which gives the number of cumulative <code>get</code>, <code>set</code> ops separately.</p>
  
  <p>e.g. in memcached I can do <code>stats</code> command and it gives:</p>
  
  <pre><code>STAT pid 1905
  STAT uptime 87713
  STAT time 1469108527
  STAT version 1.4.25
  STAT libevent 2.0.21-stable
  STAT pointer_size 64
  STAT rusage_user 300.101330
  STAT rusage_system 711.654138
  STAT curr_connections 18
  STAT total_connections 4698
  STAT connection_structures 739
  STAT reserved_fds 40
  STAT cmd_get 75355568
  STAT cmd_set 3296663
  STAT cmd_flush 0
  STAT cmd_touch 0
  STAT get_hits 44369791
  STAT get_misses 30985777
  STAT delete_misses 0
  STAT delete_hits 0
  STAT incr_misses 0
  STAT incr_hits 0
  STAT decr_misses 0
  STAT decr_hits 0
  STAT cas_misses 0
  STAT cas_hits 0
  STAT cas_badval 0
  STAT touch_hits 0
  STAT touch_misses 0
  STAT auth_cmds 0
  STAT auth_errors 0
  STAT bytes_read 3615072874
  STAT bytes_written 16173356516
  STAT limit_maxbytes 3670016000
  STAT accepting_conns 1
  STAT listen_disabled_num 0
  STAT time_in_listen_disabled_us 0
  STAT threads 8
  STAT conn_yields 1763246
  STAT hash_power_level 17
  STAT hash_bytes 1048576
  STAT hash_is_expanding 0
  STAT malloc_fails 0
  STAT bytes 331012787
  STAT curr_items 176322
  STAT total_items 3296663
  STAT expired_unfetched 0
  STAT evicted_unfetched 0
  STAT evictions 0
  STAT reclaimed 0
  STAT crawler_reclaimed 0
  STAT crawler_items_checked 0
  STAT lrutail_reflocked 0
  END
  </code></pre>
  
  <p>Using this I can find out the number of get operations in the last second (by subtracting using any client library in python). I want to get the number of get and set operations per second for redis as well.</p>
  
  <p>The only command that I have found is <code>info</code> and it has a <em>stats</em> section but it looks like this:</p>
  
  <pre><code># Stats
  slave_sync_total_commands_processed:0
  slave_sync_instantaneous_ops_per_sec:0
  total_commands_processed:11562138
  instantaneous_ops_per_sec:0
  total_connections_received:6139
  rejected_connections:0
  sync_full:0
  sync_partial_ok:0
  sync_partial_err:0
  pubsub_channels:0
  pubsub_patterns:0
  expire_scan_keys:0
  </code></pre>
  
  <p>And I don't see how I can use this to <strong>find per second statistics for get and set ops</strong>. Is there any hack or command that can do this for <strong>redis</strong>? Preferably something that can be done programmatically from python.</p>