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

core/upload_stats.c File Reference


Detailed Description

Keep track of which files we send away, and how often.

Statistics are kept by _FILENAME_ and file size, not by actual path, so two files with the same name and size will be counted in the same bin. I don't see this as a limitation because the user wouldn't be able to differentiate the files anyway. This could be extended to keep the entire path to each file and optionally show the entire path, but..

The 'upload_history' file has the following format:

Todo:
TODO: Add a check to make sure that all of the files still exist(?) grey them out if they dont, optionally remove them from the stats list (when 'Clear Non-existent Files' is clicked).
Author:
Michael Tesch
Date:
2002
Author:
Raphael Manfredi
Date:
2001-2003
Version:
1.6

#include "common.h"
#include "upload_stats.h"
#include "share.h"
#include "if/bridge/c2ui.h"
#include "lib/atoms.h"
#include "lib/file.h"
#include "lib/hashlist.h"
#include "lib/tm.h"
#include "lib/url.h"
#include "lib/walloc.h"
#include "lib/override.h"

Functions

gboolean ul_stats_eq (gconstpointer p, gconstpointer q)
guint ul_stats_hash (gconstpointer p)
ul_statsupload_stats_find (const gchar *name, guint64 size)
void upload_stats_add (const gchar *filename, filesize_t size, guint32 attempts, guint32 complete, guint64 ul_bytes)
void upload_stats_load_history (const gchar *ul_history_file_name)
void upload_stats_dump_item (gpointer p, gpointer user_data)
void upload_stats_dump_history (const gchar *ul_history_file_name)
 Save upload statistics to file.
void upload_stats_flush_if_dirty (void)
 Called on a periodic basis to flush the statistics to disk if changed since last call.
void upload_stats_file_begin (const struct shared_file *sf)
 Called when an upload starts.
void upload_stats_file_add (const gchar *name, filesize_t size, gint comp, guint64 sent)
 Add `comp' to the current completed count, and update the amount of bytes transferred.
void upload_stats_file_aborted (const struct shared_file *sf, filesize_t done)
 Called when an upload is aborted, to update the amount of bytes transferred.
void upload_stats_file_complete (const struct shared_file *sf, filesize_t done)
 Called when an upload completes.
void upload_stats_prune_nonexistent (void)
void upload_stats_free_all (void)
 Clear all the upload stats data structure.
void upload_stats_clear_all (void)
 Like upload_stats_free_all() but also clears the GUI.
void upload_stats_close (void)
 Called at shutdown time.

Variables

gboolean dirty = FALSE
gchar * stats_file
hash_list_tupload_stats_list


Function Documentation

gboolean ul_stats_eq gconstpointer  p,
gconstpointer  q
[static]
 

guint ul_stats_hash gconstpointer  p  )  [static]
 

void upload_stats_add const gchar *  filename,
filesize_t  size,
guint32  attempts,
guint32  complete,
guint64  ul_bytes
[static]
 

void upload_stats_clear_all void   ) 
 

Like upload_stats_free_all() but also clears the GUI.

void upload_stats_close void   ) 
 

Called at shutdown time.

void upload_stats_dump_history const gchar *  ul_history_file_name  )  [static]
 

Save upload statistics to file.

void upload_stats_dump_item gpointer  p,
gpointer  user_data
[static]
 

void upload_stats_file_aborted const struct shared_file sf,
filesize_t  done
 

Called when an upload is aborted, to update the amount of bytes transferred.

void upload_stats_file_add const gchar *  name,
filesize_t  size,
gint  comp,
guint64  sent
[static]
 

Add `comp' to the current completed count, and update the amount of bytes transferred.

Note that `comp' can be zero.

If the row does not exist (race condition: deleted since upload started), recreate one.

void upload_stats_file_begin const struct shared_file sf  ) 
 

Called when an upload starts.

void upload_stats_file_complete const struct shared_file sf,
filesize_t  done
 

Called when an upload completes.

struct ul_stats* upload_stats_find const gchar *  name,
guint64  size
[static]
 

void upload_stats_flush_if_dirty void   ) 
 

Called on a periodic basis to flush the statistics to disk if changed since last call.

void upload_stats_free_all void   )  [static]
 

Clear all the upload stats data structure.

void upload_stats_load_history const gchar *  ul_history_file_name  ) 
 

void upload_stats_prune_nonexistent void   ) 
 


Variable Documentation

gboolean dirty = FALSE [static]
 

gchar* stats_file [static]
 

hash_list_t* upload_stats_list [static]
 


Generated on Sat Jun 30 17:53:31 2007 for gtk-gnutella by  doxygen 1.3.9.1