/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2010, Tomasz Sowa * All rights reserved. * */ #ifndef headerfile_winix_plugins_stats_stats #define headerfile_winix_plugins_stats_stats #include #include #include #include "core/config.h" namespace Stats { struct Stats { Stats(); void ReadStats(); void SaveStats(); void PeriodicSave(); void ReadConfig(Config * config); void RemoveItem(long id); // file name for reading/saving statistics std::string stats_file; // when the statistics start time_t stats_start; int global_all; int global_unique; int global_google; int global_yahoo; int global_bing; // statistics for files/dirs struct ItemStats { int all; int google; int yahoo; int bing; ItemStats() { all = 0; google = 0; yahoo = 0; bing = 0; } }; // typedef std::map StatsTab; StatsTab stats_tab; private: // when to save the config (how many requests should have gone) // (for safety: power failure etc) // default: 1000 // you can set: stats_req_save_freq in the config file to overwrite it // 0 - turn it off int req_save_freq; int req_current; // helper void ReadStats(std::ifstream & file); void SaveStats(std::ofstream & file); }; } // namespace #endif