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

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 "if/bridge/c2ui.h"
#include "lib/file.h"
#include "lib/tm.h"
#include "lib/url.h"
#include "lib/override.h"

Functions

 RCSID ("$Id:upload_stats.c, v 1.11 2005/08/31 21:37:28 rmanfredi Exp $")
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_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.

ul_statsupload_stats_find (const gchar *name, guint64 size)
void upload_stats_file_begin (const struct upload *u)
 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 upload *u)
 Called when an upload is aborted, to update the amount of bytes transferred.

void upload_stats_file_complete (const struct upload *u)
 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 = NULL
GList * upload_stats_list = NULL


Function Documentation

RCSID "$Id:upload_stats.  c,
v 1.11 2005/08/31 21:37:28 rmanfredi Exp $" 
 

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_file_aborted const struct upload u  ) 
 

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 upload u  ) 
 

Called when an upload starts.

void upload_stats_file_complete const struct upload u  ) 
 

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 = NULL [static]
 

GList* upload_stats_list = NULL [static]
 


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