Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

search_stats.c File Reference


Detailed Description

Needs short description here.

Keep track of what search terms we have seen, and how frequently each has been seen.

Note:
This uses the glib hash tables and lists, but a much more efficient implementation could be done with a specialized hash table / re-keyable binary tree.
Author:
Raphael Manfredi
Date:
2001-2003
Author:
Michael Tesch
Date:
2002
Released with gtk-gnutella & its license.

#include "gtk/gui.h"
#include "gtk/gtk-missing.h"
#include "gtk/search_stats.h"
#include "gtk/columns.h"
#include "if/core/share.h"
#include "if/gui_property_priv.h"
#include "if/bridge/ui2c.h"
#include "lib/misc.h"
#include "lib/glib-missing.h"
#include "lib/wordvec.h"
#include "lib/override.h"

Data Structures

struct  term_counts
 This is what the stat_hash's 'val' points to. More...


Functions

 RCSID ("$Id:search_stats.c, v 1.10 2005/11/14 12:43:56 cbiere Exp $")
gboolean delete_hash_entry (gpointer key, gpointer val, gpointer data)
void empty_hash_table (void)
gboolean stats_hash_to_clist (gpointer key, gpointer value, gpointer userdata)
 helper func for stats_display - does two things:

void search_stats_tally (const word_vec_t *vec)
 Count a word that has been seen.

void search_stats_notify_word (query_type_t type, const gchar *search, const host_addr_t unused_addr, guint16 unused_port)
void search_stats_notify_whole (query_type_t type, const gchar *search, const host_addr_t unused_addr, guint16 unused_port)
void search_stats_notify_routed (query_type_t unused_type, const gchar *unused_search, const host_addr_t addr, guint16 port)
void search_stats_gui_enable (search_request_listener_t lst)
 Enable search stats.

void search_stats_gui_disable (void)
void search_stats_gui_reset (void)
 Clear the list, empty the hash table.

void search_stats_gui_set_type (gint type)
void search_stats_gui_init (void)
void search_stats_gui_shutdown (void)
void search_stats_gui_update (time_t now)
 Display the data gathered during the last time period.


Variables

guint stat_count
GHashTable * stat_hash = NULL
gboolean callback_registered = FALSE
gint selected_type = NO_SEARCH_STATS


Function Documentation

gboolean delete_hash_entry gpointer  key,
gpointer  val,
gpointer  data
[static]
 

void empty_hash_table void   )  [static]
 

RCSID "$Id:search_stats.  c,
v 1.10 2005/11/14 12:43:56 cbiere Exp $" 
 

void search_stats_gui_disable void   )  [static]
 

void search_stats_gui_enable search_request_listener_t  lst  )  [static]
 

Enable search stats.

void search_stats_gui_init void   ) 
 

void search_stats_gui_reset void   ) 
 

Clear the list, empty the hash table.

void search_stats_gui_set_type gint  type  ) 
 

void search_stats_gui_shutdown void   ) 
 

void search_stats_gui_update time_t  now  ) 
 

Display the data gathered during the last time period.

Perhaps it would be better to have this done on a button click(?)

void search_stats_notify_routed query_type_t  unused_type,
const gchar *  unused_search,
const host_addr_t  addr,
guint16  port
[static]
 

void search_stats_notify_whole query_type_t  type,
const gchar *  search,
const host_addr_t  unused_addr,
guint16  unused_port
[static]
 

void search_stats_notify_word query_type_t  type,
const gchar *  search,
const host_addr_t  unused_addr,
guint16  unused_port
[static]
 

void search_stats_tally const word_vec_t vec  )  [static]
 

Count a word that has been seen.

gboolean stats_hash_to_clist gpointer  key,
gpointer  value,
gpointer  unused_udata
[static]
 

helper func for stats_display - does two things:

  • clears out aged / infrequent search terms

sticks the rest of the search terms in clist_search_stats


Variable Documentation

gboolean callback_registered = FALSE [static]
 

gint selected_type = NO_SEARCH_STATS [static]
 

guint stat_count [static]
 

GHashTable* stat_hash = NULL [static]
 


Generated on Sun Feb 12 10:50:07 2006 for Gtk-Gnutella by doxygen 1.3.6