Changeset 1875

Show
Ignore:
Timestamp:
08/20/08 00:11:49 (3 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1871 r1875  
    112008-08-19  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/handler_server_info.c (build_cache_table_content): It 
     4        adds a new table showing some general file caching statistics. 
    25 
    36        * cherokee/connection.c (cherokee_connection_set_redirect), 
  • cherokee/trunk/cherokee/handler_server_info.c

    r1795 r1875  
    380380 
    381381static void 
     382build_cache_table_content (cherokee_buffer_t *buf) 
     383{ 
     384        ret_t               ret; 
     385        cherokee_iocache_t *iocache = NULL; 
     386        char                tmp[8]; 
     387        float               percent; 
     388 
     389        ret = cherokee_iocache_get_default (&iocache); 
     390        if ((ret != ret_ok) || (iocache == NULL)) { 
     391                table_add_row_str (buf, "Caching", "disabled"); 
     392                return; 
     393        } 
     394 
     395        table_add_row_int (buf, "Fetches", iocache->cache.count); 
     396 
     397        if (iocache->cache.count == 0) 
     398                percent = 0; 
     399        else 
     400                percent = (iocache->cache.count_hit * 100.0) / iocache->cache.count; 
     401        snprintf (tmp, sizeof(tmp), "%.2f%%", percent); 
     402        table_add_row_str (buf, "Total Hits", tmp); 
     403 
     404        if (iocache->cache.count == 0) 
     405                percent = 0; 
     406        else 
     407                percent = (iocache->cache.count_miss * 100.0) / iocache->cache.count; 
     408        snprintf (tmp, sizeof(tmp), "%.2f%%", percent); 
     409        table_add_row_str (buf, "Total Misses", tmp); 
     410} 
     411 
     412static void 
    382413build_connection_details_content (cherokee_buffer_t *buf, cherokee_list_t *infos)  
    383414{ 
     
    474505                build_icons_table_content (&table, srv); 
    475506                server_info_add_table (buf, "Icons", "icons", &table); 
     507 
     508                /* Caching information 
     509                 */ 
     510                cherokee_buffer_clean (&table); 
     511                build_cache_table_content (&table); 
     512                server_info_add_table (buf, "File Caching", "iocache", &table); 
    476513        } 
    477514