stats: no CamelCase

Renamed functions and types.
This commit is contained in:
Max Kellermann 2009-01-18 15:22:26 +01:00
parent e8c148ab02
commit 0d449d8df7
4 changed files with 26 additions and 23 deletions

View File

@ -1061,7 +1061,7 @@ static enum command_return
handle_stats(struct client *client, handle_stats(struct client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
return printStats(client); return stats_print(client);
} }
static enum command_return static enum command_return

View File

@ -243,7 +243,7 @@ int main(int argc, char *argv[])
if (options.kill) if (options.kill)
killFromPidFile(); killFromPidFile();
initStats(); stats_global_init();
tag_lib_init(); tag_lib_init();
log_init(options.verbose, options.stdOutput); log_init(options.verbose, options.stdOutput);

View File

@ -26,18 +26,17 @@
#include "strset.h" #include "strset.h"
#include "dbUtils.h" #include "dbUtils.h"
Stats stats; struct stats stats;
void initStats(void) void stats_global_init(void)
{ {
stats.daemonStart = time(NULL); stats.start_time = time(NULL);
stats.numberOfSongs = 0;
} }
void stats_update(void) void stats_update(void)
{ {
stats.numberOfSongs = countSongsIn(NULL); stats.song_count = countSongsIn(NULL);
stats.dbPlayTime = sumSongTimesIn(NULL); stats.song_duration = sumSongTimesIn(NULL);
} }
struct visit_data { struct visit_data {
@ -63,7 +62,8 @@ visit_tag_items(struct song *song, void *_data)
return 0; return 0;
} }
static unsigned int getNumberOfTagItems(int type) static unsigned int
getNumberOfTagItems(enum tag_type type)
{ {
struct visit_data data = { struct visit_data data = {
.type = type, .type = type,
@ -78,7 +78,7 @@ static unsigned int getNumberOfTagItems(int type)
return ret; return ret;
} }
int printStats(struct client *client) int stats_print(struct client *client)
{ {
client_printf(client, client_printf(client,
"artists: %u\n" "artists: %u\n"
@ -90,10 +90,10 @@ int printStats(struct client *client)
"db_update: %li\n", "db_update: %li\n",
getNumberOfTagItems(TAG_ITEM_ARTIST), getNumberOfTagItems(TAG_ITEM_ARTIST),
getNumberOfTagItems(TAG_ITEM_ALBUM), getNumberOfTagItems(TAG_ITEM_ALBUM),
stats.numberOfSongs, stats.song_count,
time(NULL) - stats.daemonStart, time(NULL) - stats.start_time,
(long)(getPlayerTotalPlayTime() + 0.5), (long)(getPlayerTotalPlayTime() + 0.5),
stats.dbPlayTime, stats.song_duration,
db_get_mtime()); db_get_mtime());
return 0; return 0;
} }

View File

@ -21,20 +21,23 @@
struct client; struct client;
typedef struct _Stats { struct stats {
unsigned long daemonStart; unsigned long start_time;
int numberOfSongs;
unsigned long dbPlayTime;
/*unsigned long playTime;
unsigned long songsPlayed; */
} Stats;
extern Stats stats; /** number of song files in the music directory */
unsigned song_count;
void initStats(void); /** sum of all song durations in the music directory (in
seconds) */
unsigned long song_duration;
};
extern struct stats stats;
void stats_global_init(void);
void stats_update(void); void stats_update(void);
int printStats(struct client *client); int stats_print(struct client *client);
#endif #endif