util.c


Log

Author Commit Date CI Message
Con Kolivas 8745ba1e 2012-08-15T09:38:45 Windows' timer resolution is limited to 15ms accuracy. This was breaking dynamic intensity since it tries to measure below this. Since we are repeatedly sampling similar timeframes, we can average the gpu_us result over 5 different values to get very fine precision.
Luke Dashjr 9c648c17 2012-07-11T20:10:52 Bugfix: Calculate nsec in nmsleep correctly The old algorithm (msecs * 1000000) - (sec / 1000000000) gets total nsec, including seconds, since the sec/1e9 should be multiplying. It's also vulnerable to easy overflows. Using ldiv gets the quotient and remainder in a single operation (at least on x86) and avoids overflow.
Con Kolivas bc0b1406 2012-07-08T21:35:19 Cope with signals interrupting the nanosleep of nmsleep.
Con Kolivas 3271be14 2012-07-06T15:01:39 Provide a ms based sleep function that uses nanosleep to avoid the inaccuracy of usleep on SMP systems.
ckolivas 1a43f795 2012-07-01T12:02:10 Mingw doesn't support asprintf, use sprintf.
ckolivas 1e942147 2012-07-01T10:44:23 Timersub is supported on all build platforms so do away with custom timerval_subtract function.
ckolivas 75ea6164 2012-07-01T10:35:08 Minor style police on util.c
ckolivas 8f954d40 2012-07-01T10:17:12 Get rid of unused result warning with asprintf.
Con Kolivas 3267b534 2012-06-28T10:43:52 Implement rudimentary X-Mining-Hashrate support.
ckolivas c5a21fab 2012-06-23T23:43:22 Extend nrolltime to support the expiry= parameter. Do this by turning the rolltime bool into an integer set to the expiry time. If the pool supports rolltime but not expiry= then set the expiry time to the standard scantime.
Con Kolivas 268039cc 2012-04-28T00:32:47 Indentation clean up.
Con Kolivas eda38299 2012-04-27T11:58:47 Create one longpoll thread per pool, using backup pools for those pools that don't have longpoll. Use the work created from the longpoll return only if we don't have failover-enabled, and only flag the work as a longpoll if it is the current pool. This will work around the problem of trying to restart the single longpoll thread on pool changes that was leading to race conditions. It will also have less work restarts from the multiple longpolls received from different pools.
Con Kolivas 9609dbc4 2012-04-20T21:09:37 Set lp_path to NULL after free for consistency.
nelisky 17b9baa9 2012-04-20T03:36:42 Removing dmalloc import left behind by mistake
nelisky 44bcb69c 2012-04-19T14:45:40 Fixing leak in resp_hdr_cb Memory is allocated for key and val, and longpoll address, when found, is stored in the header_info and prevented from being freed there. This pointer is stored during pool probing but once that's done it was just being lost. Not so visible but also leaking was the refuse reason string.
Luke Dashjr ed8382c8 2012-03-12T14:56:05 Make curses TUI support optional at compile-time.
Con Kolivas d1cddf8b 2012-02-21T22:23:07 Update licensing to GPL V3.
Con Kolivas f4284a21 2012-02-21T09:20:31 Set the lp_sent variable under lock since there will almost always be a race on setting this variable, potentially leading to multiple LPs being sent out.
Con Kolivas fe4b5e1f 2012-02-20T08:24:41 Set the lp_sent bool earlier to minimise the number of extra longpolls sent out.
Con Kolivas 39906718 2012-02-19T22:07:31 Keep track of when a longpoll has been sent for a pool and if the current pool is requesting work but has not sent a longpoll request, convert one of the work items to a longpoll as we may have switched pools but still be using the longpoll from the previous pool.
Con Kolivas 810ad045 2012-02-18T23:16:08 More copyright updates.
Con Kolivas be9db9ce 2012-02-18T23:00:21 Copyright updates.
Con Kolivas 06721957 2012-02-18T16:34:06 Freeze the queues on all threads that are sent the pause message to prevent them trying to start up again with saved pings in their queues.
Con Kolivas 3d3a3a2f 2012-02-15T21:42:12 Fix unused warnings on win32.
Luke Dashjr 9631c0b0 2012-02-13T21:46:14 Fix initialization warning with jansson 1.3
Con Kolivas 56907db2 2012-02-12T18:21:30 Fix harmless warnings with -Wsign-compare to allow cgminer to build with -W.
Con Kolivas 11123848 2012-02-12T17:53:50 Fix missing field initialisers warnings.
Con Kolivas 07c2ee53 2012-02-12T17:00:44 Put win32 equivalents of nanosleep and sleep into compat.h fixing sleep() for adl.c.
zefir e0fec357 2012-02-11T19:31:34 modularized logging, support for priority based logging Functions related to logging are extracted into dedicated source files for better maintainability. The existing low-level logging API is extended with a generalized scheme providing log functions log_{error, warning, notice, info, debug} that log messages based on a global opt_log_level. opt_log_level for now is set to LOG_NOTICE and might be modified via command line options or config files in future releases.
Con Kolivas 405a2120 2012-02-11T20:11:18 Remove unnecessary check for opt_debug on every invocation of applog at LOG_DEBUG and place the check in applog().
Con Kolivas b706da93 2012-02-11T14:55:12 Merge branch 'reject_reason' of https://github.com/luke-jr/cgminer into reject
Con Kolivas 5b476100 2012-02-09T21:54:23 Move from the thread safe localtime_r to regular localtime which is the only one supported on newer pthread libraries on mingw32 to make it compile with the newer ming. Thread safety is of no importance where localtime is used in this code.
Luke Dashjr f7a9897e 2012-01-26T00:07:42 Display X-Reject-Reason, when provided
Con Kolivas de4c6c29 2012-02-06T18:12:22 Provide support for the submitold extension on a per-pool basis based on the value being detected in a longpoll.
Con Kolivas e57ac017 2012-02-05T22:43:42 Remove unused get_dondata function.
Con Kolivas 36d2fa48 2012-02-05T22:39:28 Silence unused parameter warnings.
ckolivas 13fa5772 2012-02-04T20:04:49 Probe but don't set the timeout to 15 seconds as some networks take a long time to timeout.
ckolivas 1832b20c 2012-02-04T20:04:07 Revert "Some networks can take a long time to resolve so go back to 60 second timeouts instead of 15." This reverts commit c86a670ce6d264fba10a38f68d65e4b4ab27cba6. This changed more than just the timeout.
ckolivas c86a670c 2012-02-04T13:06:04 Some networks can take a long time to resolve so go back to 60 second timeouts instead of 15.
Con Kolivas bdec295f 2012-01-30T17:58:22 Set the latest network access time on share submission for --net-delay even if we're not delaying that submission for further network access.
Kano b188157c 2012-01-30T16:43:14 Resume advertising midstate support
Con Kolivas 3de7c7f9 2012-01-30T15:51:46 Stop advertising midstate support until it's fixed.
Con Kolivas 09184720 2012-01-30T15:09:58 As share submission is usually staggered, and delays can be costly, submit shares without delay even when --net-delay is enabled.
Con Kolivas 82af288e 2012-01-29T22:57:29 Revert "Fix various harmless warnings." This reverts commit a4b67f030fc0c7e2b18e79114a441c1e1617d5f8.
Con Kolivas a4b67f03 2012-01-29T21:06:17 Fix various harmless warnings.
Luke Dashjr fe88648e 2012-01-24T18:10:38 Advertise longpoll support in X-Mining-Extensions
Con Kolivas 6442c1ab 2012-01-22T20:36:57 Style police.
Midnight Magic 21633b9b 2012-01-21T15:12:45 Bringing back TCP_NODELAY, but also ensuring it doesn't conflict with --net-delay : Nagle's may infact delay some packets longer than necessary..
Con Kolivas e15d57d7 2012-01-22T09:36:21 Implement socks4 proxy support.
Con Kolivas 5179d224 2012-01-20T15:36:42 Introduce a --net-delay option which guarantees at least 250ms between any networking requests to not overload slow routers.
Luke Dashjr ebe21db3 2012-01-17T22:05:20 Advertise that we can make our own midstate, so the pool can skip generating it for us
Con Kolivas 4cf433c9 2012-01-17T16:21:08 Remove TCP_NODELAY from curl options as many small packets may be contributing to network overload.
Con Kolivas 638c8c52 2012-01-01T14:21:22 Make curl use a fresh connection if the json rpc call fails for any reason in case curl is relying on dead persistent connections.
Con Kolivas 19e373b8 2011-12-30T11:31:16 All threads are detached so there is no need to join them and it may dereference causing crash on exit.
Kano 5033dcd3 2011-12-27T18:33:49 fix test/set of thr->pth to also work in windows
Con Kolivas 2257b502 2011-12-27T11:37:30 Simplify longpoll changeover to just check which pool it should grab its next longpoll from. This should prevent locking hangs and thread cancellation crashes.
Con Kolivas a51514d9 2011-12-27T10:30:04 White space cleanup.
Con Kolivas b69aa234 2011-12-26T10:49:27 Use control_lock to protect thr->pth for thread creation/destruction.
Con Kolivas 59293a37 2011-12-26T09:29:16 Only pthread_join when pthread_cancel does not return an error.
Con Kolivas 13c40f75 2011-12-25T00:06:25 Zero all pthread_t identities upon cancelling threads.
Con Kolivas 689f8abb 2011-10-09T12:33:54 Try to use SSL if the server supports it.
Con Kolivas 4128b954 2011-09-26T18:49:15 Add a --donation feature which reads a url/userpass from the author's site and contributes a percentage of getworks to the author, but default to off.
Kano ba14a670 2011-09-21T21:45:24 Remove EOL spaces from stderr and curses
Kano 8ecd15a6 2011-09-20T16:19:21 Add BLOCK! notification and remove end of line blanks when not needed
Con Kolivas b8ea0dd1 2011-09-17T13:23:58 Update curses logging to allow LOG_WARNING and LOG_ERR messages to still go through while within the menu, and drop share message to LOG_NOTICE.
Con Kolivas 8e2becc1 2011-09-15T11:45:24 Change pth from being a pointer as we can dereference if we're unlucky on stopping longpoll.
Con Kolivas 833e020d 2011-09-15T10:33:23 Standardise the way all non-mining threads are destroyed to make sure we can safely cancel them, freeing ram and NULLifying pointers.
Luke Dashjr 1f15d7ea 2011-09-09T17:52:21 Advertise rollntime extension support Thanks to raijin for testing!
Con Kolivas a0a5858d 2011-09-06T12:00:40 Use the presence of X-Roll-Ntime in the header as a bool for exists unless N is found in the response.
Con Kolivas 5d845f2f 2011-09-02T10:13:33 If curl does not have sockopts, do not try to compile the json_rpc_call_sockopt_cb function, making it possible to build against older curl libraries.
Con Kolivas a593afdb 2011-08-31T13:23:36 Use the curses_lock to protect the curses_active variable and test it under lock.
Con Kolivas 437d6f05 2011-08-26T13:32:41 Disable curl debugging with opt protocol since it spews to stderr.
Con Kolivas 91a2e701 2011-08-26T12:12:54 Actually check the value returned for the x-roll-ntime extension to make sure it isn't saying N.
Con Kolivas 666fcc3f 2011-08-24T08:06:15 Move staged threads to hashes so we can sort them by time.
Con Kolivas dfec430c 2011-08-22T08:04:30 Make the tcp setsockopts unique to linux in the hope it allows freebsd et. al to compile.
Con Kolivas d89a6c57 2011-08-18T21:35:05 Since we check roll time per work item now, it need only be debug log level.
Con Kolivas 3edc1dfe 2011-08-17T22:33:46 Test at appropriate target difficulty now.
Con Kolivas 1e77f044 2011-08-17T12:43:39 Clean up the longpoll management to ensure the right paths go to the right pool and display whether we're connected to LP or not in the status line.
Con Kolivas 426f72de 2011-08-16T10:27:19 As we have keepalives now, blaming network flakiness on timeouts appears to have been wrong. Set a timeout for longpoll to 1 hour, and most other network connectivity to 1 minute.
Con Kolivas 657812ad 2011-08-16T10:15:47 Probe for slightly longer for when network conditions are lagging.
Con Kolivas d6dd5d70 2011-08-14T01:54:47 Test each work item to see if it can be rolled instead of per-pool and roll whenever possible, adhering to the 60 second timeout.
Con Kolivas 5f667e7e 2011-07-30T13:36:08 Get rid of extra line feeds.
Con Kolivas 53e05c64 2011-07-28T19:55:54 Log to the output file at any time with warnings and errors, instead of just when verbose mode is on.
Con Kolivas 0006eb2d 2011-07-28T10:36:48 Make the "quiet" mode still update the status and display errors, and add a new --real-quiet option which disables all output and can be set once while running.
Con Kolivas e82e3902 2011-07-27T16:40:52 If work has been cloned it is already at the head of the list and when being reinserted into the queue it should be placed back at the head of the list.
Con Kolivas 98f609b5 2011-07-27T10:31:44 Sanity check to prove locking.
Con Kolivas a187fe1e 2011-07-25T13:00:44 Try to do every curses manipulation under the curses lock.
Con Kolivas 5f54e164 2011-07-25T10:58:32 Only use the sockoptfunction if the version of curl is recent enough.
Con Kolivas 40198313 2011-07-24T17:34:57 Do away with GET for dealing with longpoll forever. POST is the one that works everywhere, not the other way around.
Ycros 0c25ff84 2011-07-23T17:11:16 OSX: fix setsockopt compile bug
Ycros d37c3fe5 2011-07-22T23:43:26 Win32 threading and longpoll keepalive fixes.
Con Kolivas fe8b0416 2011-07-22T12:22:55 Make --no-longpoll work again.
Con Kolivas b0a8f279 2011-07-22T11:46:26 Implement the ability to live add, enable, disable, and switch to pools.
Michael Kedzierski d987006c 2011-07-20T23:48:06 TCP KEEPALIVE support for long polling.
Con Kolivas b56ed748 2011-07-19T23:06:11 When json rpc errors occur they occur in spits and starts, so trying to limit them with the comms error bool doesn't stop a flood of them appearing. Make the json errors LOG_INFO level instead so they don't normally show up.
Con Kolivas 81ff7fb3 2011-07-19T13:01:08 Explicitly probe each pool to see if work can be retrieved from it and what it supports.
Con Kolivas 913e1202 2011-07-19T12:29:33 Test for rolltime and save it correctly when testing for longpoll.
Con Kolivas 0ce3df10 2011-07-19T11:45:58 Store whether each server supports X-Roll-Ntime or not.
Con Kolivas 321c4798 2011-07-19T10:53:04 Make longpoll switch servers should it not match the current pool.
Con Kolivas cdc72dae 2011-07-19T09:26:23 Some servers regularly return empty responses. Drop the message from ERR to INFO.