tmem stats
PATCH 1/1 tmem stats
This patch collects a few additional valuable per-domain performance stats. Applies against c/s 19845.
Signed-off-by Dan Magenheimer <[email protected]>
tools/misc/xen-tmem-list-parse.c +7 -0
@@ -174,12 +174,19 @@ void parse_client(char *s)unsigned long long compressed_sum_size =parse (s,"cb" );unsigned long long compress_poor =parse (s,"cn" );unsigned long long compress_nomem =parse (s,"cm" ); +unsigned long long total_cycles =parse (s,"Tc" ); +unsigned long long succ_eph_gets =parse (s,"Ge" ); +unsigned long long succ_pers_puts =parse (s,"Pp" ); +unsigned long long succ_pers_gets =parse (s,"Gp" );printf ("domid%lu: weight=%lu,cap=%lu,compress=%d,frozen=%d," +"total_cycles=%llu,succ_eph_gets=%llu," +"succ_pers_puts=%llu,succ_pers_gets=%llu," "eph_count=%llu,max_eph=%llu," "compression ratio=%lu%% (samples=%llu,poor=%llu,nomem=%llu)\n" , cli_id, weight, cap, compress?1 :0 , frozen?1 :0 , eph_count, max_eph_count, + total_cycles, succ_eph_gets, succ_pers_puts, succ_pers_gets, compressed_pages ? (long )((compressed_sum_size*100LL ) / (compressed_pages*PAGE_SIZE )) :0 , compressed_pages, compress_poor, compress_nomem);
xen/common/tmem.c +24 -10
@@ -119,6 +119,8 @@ struct client {unsigned long compress_poor, compress_nomem;unsigned long compressed_pages;uint64_t compressed_sum_size; +uint64_t total_cycles; +unsigned long succ_pers_puts, succ_eph_gets, succ_pers_gets; };typedef struct client client_t ;
@@ -842,6 +844,8 @@ static client_t *client_create(void)list_add_tail (&client->client_list, &global_client_list);INIT_LIST_HEAD (&client->ephemeral_page_list); client->eph_count = client->eph_count_max =0 ; + client->total_cycles =0 ; client->succ_pers_puts =0 ; + client->succ_eph_gets =0 ; client->succ_pers_gets =0 ;printk ("ok\n" );return client; }
@@ -1081,6 +1085,8 @@ done:tmem_spin_unlock (&obj->obj_spinlock); pool->dup_puts_replaced++; pool->good_puts++; +if (is_persistent (pool) ) + client->succ_pers_puts++;return 1 ; bad_copy:
@@ -1208,6 +1214,8 @@ insert_page: obj->no_evict =0 ;tmem_spin_unlock (&obj->obj_spinlock); pool->good_puts++; +if (is_persistent (pool) ) + client->succ_pers_puts++;return 1 ; delete_and_free:
@@ -1307,6 +1315,10 @@ static NOINLINE int do_tmem_get(pool_t *tmem_spin_unlock (&obj->obj_spinlock); } pool->found_gets++; +if (is_ephemeral (pool) ) + client->succ_eph_gets++; +else + client->succ_pers_gets++;return 1 ; bad_copy:
@@ -1539,9 +1551,11 @@ static int tmemc_list_client(client_t *cpool_t *p;bool_t s; - n =scnprintf (info,BSIZE ,"C=CI:%d,ww:%d,ca:%d,co:%d,fr:%d%c" , - c->cli_id, c->weight, c->cap, c->compress, - c->frozen, use_long ?',' :'\n' ); + n =scnprintf (info,BSIZE ,"C=CI:%d,ww:%d,ca:%d,co:%d,fr:%d," +"Tc:%" PRIu64",Ge:%ld,Pp:%ld,Gp:%ld%c" , + c->cli_id, c->weight, c->cap, c->compress, c->frozen, + c->total_cycles, c->succ_eph_gets, c->succ_pers_puts, c->succ_pers_gets, + use_long ?',' :'\n' );if (use_long) n += scnprintf(info+n,BSIZE-n, "Ec:%ld,Em:%ld,cp:%ld,cb:%"PRId64",cn:%ld,cm:%ld\n",
@@ -1944,17 +1958,17 @@ out:if ( rc <0 ) errored_tmem_ops++;if ( succ_get ) -END_CYC_COUNTER (succ_get); +END_CYC_COUNTER_CLI (succ_get,client);else if ( succ_put ) -END_CYC_COUNTER (succ_put); +END_CYC_COUNTER_CLI (succ_put,client);else if ( non_succ_get ) -END_CYC_COUNTER (non_succ_get); +END_CYC_COUNTER_CLI (non_succ_get,client);else if ( non_succ_put ) -END_CYC_COUNTER (non_succ_put); +END_CYC_COUNTER_CLI (non_succ_put,client);else if ( flush ) -END_CYC_COUNTER (flush); -else -END_CYC_COUNTER (flush_obj); +END_CYC_COUNTER_CLI (flush,client); +else if ( flush_obj ) +END_CYC_COUNTER_CLI (flush_obj,client);if ( tmh_lock_all ) {
xen/include/xen/tmem_xen.h +10 -0
@@ -360,6 +360,16 @@ extern int tmh_copy_to_client(tmem_cli_m if ((uint32_t)x##_start > x##_max_cycles) x##_max_cycles = x##_start; \ } \ } while (0) +#define END_CYC_COUNTER_CLI (x,y) \ + do { \ + x##_start = get_cycles() - x##_start; \ + if (x##_start > 0 && x##_start < 1000000000) { \ + x##_sum_cycles += x##_start; x##_count++; \ + if ((uint32_t)x##_start < x##_min_cycles) x##_min_cycles = x##_start; \ + if ((uint32_t)x##_start > x##_max_cycles) x##_max_cycles = x##_start; \ + y->total_cycles += x##_start; \ + } \ + } while (0)#define RESET_CYC_COUNTER (x) { x##_sum_cycles = 0, x##_count = 0; \ x##_min_cycles = 0x7fffffff, x##_max_cycles = 0; }#define SCNPRINTF_CYC_COUNTER (buf,size,x,tag) \
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel