- Client (Win): in file_size(), use _stat64() instead of stat().

Otherwise it doesn't work for files >= 2GB
	- Client: TIME_STATS::trim_stats_log() wasn't working because
		it's called in the constructor of TIME_STATS,
		which is called before we've done a chdir() to the data dir.

	Note: for this reason, no disk access should be done in constructors
	of global objects.  A quick scan found no instances of this.

svn path=/trunk/boinc/; revision=25846
This commit is contained in:
David Anderson 2012-07-03 22:36:59 +00:00
parent bcf10a7421
commit f9a9c3090f
5 changed files with 28 additions and 6 deletions

View File

@ -4703,3 +4703,19 @@ Charlie 3 July 2012
mac_build/ mac_build/
boinc.xcodeproj/ boinc.xcodeproj/
project.pbxproj project.pbxproj
David 3 July 2012
- Client (Win): in file_size(), use _stat64() instead of stat().
Otherwise it doesn't work for files >= 2GB
- Client: TIME_STATS::trim_stats_log() wasn't working because
it's called in the constructor of TIME_STATS,
which is called before we've done a chdir() to the data dir.
Note: for this reason, no disk access should be done in constructors
of global objects. A quick scan found no instances of this.
client/
client_state.cpp
time_stats.cpp,h
lib/
filesys.cpp

View File

@ -304,6 +304,7 @@ int CLIENT_STATE::init() {
notices.init(); notices.init();
daily_xfer_history.init(); daily_xfer_history.init();
time_stats.init();
detect_platforms(); detect_platforms();
time_stats.start(); time_stats.start();

View File

@ -76,7 +76,7 @@ int get_connected_state() {
const float ALPHA = (SECONDS_PER_DAY*10); const float ALPHA = (SECONDS_PER_DAY*10);
//const float ALPHA = 60; // for testing //const float ALPHA = 60; // for testing
TIME_STATS::TIME_STATS() { void TIME_STATS::init() {
last_update = 0; last_update = 0;
first = true; first = true;
on_frac = 1; on_frac = 1;

View File

@ -21,10 +21,10 @@
#include "miofile.h" #include "miofile.h"
#include <vector> #include <vector>
class TIME_STATS { struct TIME_STATS {
bool first; bool first;
int previous_connected_state; int previous_connected_state;
public:
double last_update; double last_update;
// we maintain an exponentially weighted average of these quantities: // we maintain an exponentially weighted average of these quantities:
double on_frac; double on_frac;
@ -50,7 +50,7 @@ public:
void update(int suspend_reason, int gpu_suspend_reason); void update(int suspend_reason, int gpu_suspend_reason);
TIME_STATS(); void init();
int write(MIOFILE&, bool to_server); int write(MIOFILE&, bool to_server);
int parse(XML_PARSER&); int parse(XML_PARSER&);

View File

@ -324,10 +324,15 @@ int boinc_delete_file(const char* path) {
// get file size // get file size
// //
int file_size(const char* path, double& size) { int file_size(const char* path, double& size) {
struct stat sbuf;
int retval; int retval;
#if defined(_WIN32) && !defined(__CYGWIN32__)
struct __stat64 sbuf;
retval = _stat64(path, &sbuf);
#else
struct stat sbuf;
retval = stat(path, &sbuf); retval = stat(path, &sbuf);
#endif
if (retval) return ERR_NOT_FOUND; if (retval) return ERR_NOT_FOUND;
size = (double)sbuf.st_size; size = (double)sbuf.st_size;
return 0; return 0;