Browse Source

Merge commit '6bbd753' into bfgminer

Luke Dashjr 13 years ago
parent
commit
3fbe93eca7
2 changed files with 5 additions and 6 deletions
  1. 2 3
      driver-opencl.c
  2. 3 3
      miner.c

+ 2 - 3
driver-opencl.c

@@ -1606,6 +1606,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
 	unsigned int hashes;
 
 	/* This finish flushes the readbuffer set with CL_FALSE later */
+	gettimeofday(&gpu->tv_gpustart, NULL);
 	clFinish(clState->commandQueue);
 	gettimeofday(&gpu->tv_gpuend, NULL);
 
@@ -1615,7 +1616,7 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
 
 		timersub(&gpu->tv_gpuend, &gpu->tv_gpustart, &diff);
 		gpu_us = diff.tv_sec * 1000000 + diff.tv_usec;
-		if (likely(gpu_us > 0)) {
+		if (likely(gpu_us >= 0)) {
 			gpu->gpu_us_average = (gpu->gpu_us_average + gpu_us * 0.63) / 1.63;
 
 			/* Try to not let the GPU be out for longer than 
@@ -1661,8 +1662,6 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
 		clFinish(clState->commandQueue);
 	}
 
-	gettimeofday(&gpu->tv_gpustart, NULL);
-
 	if (clState->goffset) {
 		size_t global_work_offset[1];
 

+ 3 - 3
miner.c

@@ -223,7 +223,7 @@ static const char def_conf[] = "bfgminer.conf";
 static bool config_loaded;
 static int include_count;
 #define JSON_INCLUDE_CONF "include"
-#define JSON_LOAD_ERROR "JSON decode of file '%s' failed"
+#define JSON_LOAD_ERROR "JSON decode of file '%s' failed\n %s"
 #define JSON_LOAD_ERROR_LEN strlen(JSON_LOAD_ERROR)
 #define JSON_MAX_DEPTH 10
 #define JSON_MAX_DEPTH_ERR "Too many levels of JSON includes (limit 10) or a loop"
@@ -1110,11 +1110,11 @@ static char *load_config(const char *arg, void __maybe_unused *unused)
 	config = json_load_file(arg, &err);
 #endif
 	if (!json_is_object(config)) {
-		json_error = malloc(JSON_LOAD_ERROR_LEN + strlen(arg));
+		json_error = malloc(JSON_LOAD_ERROR_LEN + strlen(arg) + strlen(err.text));
 		if (!json_error)
 			quit(1, "Malloc failure in json error");
 
-		sprintf(json_error, JSON_LOAD_ERROR, arg);
+		sprintf(json_error, JSON_LOAD_ERROR, arg, err.text);
 		return json_error;
 	}