Commit Graph

110 Commits

Author SHA1 Message Date
David Anderson 89248f56c9 Merge pull request #2074 from BOINC/am_parse_fix
Fix parsing of AM reply messages
2017-08-25 15:35:42 -07:00
David Anderson 870d34ad03 Fix parsing of AM reply messages
- use std::string instead of malloced array for ACCT_MGR_OP::global_prefs_xml
- use copy_element_contents() instead of dup_element_contents()
  to get global prefs.
  The latter uses fgets instead of fgetc,
  so it requires that close tag be on a line by itself.
  TODO: don't use fgets anywhere in XML parsing.
- fix a bug in copy_element_contents() where it consumes an extra character
2017-08-14 14:46:30 -07:00
Vitalii Koshura ac291dd0d1
client: Move 'strlen' function outside of the loop
From PVS Studio:
V814
Decreased performance. The 'strlen' function was called multiple times inside the body of a loop.
https://www.viva64.com/en/w/V814/print

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
2017-05-02 16:10:08 +03:00
David Anderson 8008b32bd7 client: show max disk usage correctly 2017-04-18 13:26:12 -07:00
David Anderson 056baff691 client: reduce delay restarting tasks after exclusize app exits
There was a 20-30 second delay between exclusive app exit
and resuming tasks.  This was excessive.
Reduce it to 5-15 sec (uncertainty is because we
check exclusive apps every 10 sec)
2016-01-28 19:58:18 -08:00
David Anderson 259a0d1732 client: print network suspend reasons as strings 2015-10-12 14:48:03 -07:00
David Anderson b0aa29dd56 client: fix compile warning 2015-09-23 00:51:50 -07:00
David Anderson 28e18f6b8d Manager, client: use WxWidgets functions for number formatting
Turns out WxWidgets has functions for localized number formatting.
This was added in 2.9 so we weren't able to use it last time I checked.

Remove our own number-formatting code.
Don't do localized number formatting in client.
2015-09-22 11:22:07 -07:00
David Anderson 7f91596fae Manager, client: have comma_print() return a std::string, avoid static buffer problem 2015-08-27 15:05:56 -07:00
David Anderson d10bf89a25 Manager and client: print numbers with thousands separators in various places 2015-08-26 12:50:11 -07:00
David Anderson 2bb3e74782 Client: fix bug involving needs_network tasks
In deciding whether to schedule needs_network tasks,
we were looking at gstate.network_suspended.
The problem is that this remains false for 5 minutes
after any GUI RPC that could generate network activity.
Instead, look at gstate.file_xfers_suspended.
2014-11-10 01:04:33 -08:00
David Anderson 1e2fcb4b68 client/lib: change CONFIG to CC_CONFIG, config to cc_config.
Eliminates ambiguity of "config" global var, which is used in server code.
This confuses IDEs that are looking at all the code at once.
2014-05-08 00:51:18 -07:00
David Anderson 6a8eab73cd replace tab characters with spaces 2014-05-01 21:03:49 -07:00
Joachim Fritzsch 79a09152b5 android: change so 'user active', i.e. screen on, suspension only applies to computation, not to network activity. allow project initialization right after attach. 2014-03-04 14:59:28 +01:00
Joachim Fritzsch 218cb433e4 re-enable accidentally disabled check for user activity on not-Android platforms. 2014-02-18 12:34:30 +01:00
David Anderson 7455e6b5b7 Client (Android): if no keepalive from GUI, exit rather than suspend
Also: message tweaks
2014-02-17 15:40:58 -08:00
Joachim Fritzsch ef60e181d5 android: added preferences to suspend when screen on. default is true. sets user_active in device status RPC. 2014-02-14 15:17:52 +01:00
David Anderson 38e83a3cd7 Client: don't use sub-second CPU throttling
I forgot that the wrapper has a 1-second poll for suspend and resume,
so sub-second throttling won't work properly for wrapper apps.
Revert to a variant of the old scheme,
in which the min of the suspended and resumed periods is 1 sec.

Also, fix task start/suspend/resume log messages.
2014-01-22 17:26:26 -08:00
David Anderson ebde7809ce client: preliminary implementation (commented out) of sub-second throttling 2013-09-20 14:30:04 -07:00
David Anderson dd41c91c32 client: message tweaks 2013-09-17 13:05:06 -07:00
David Anderson 18f797b6bf client (Android): in check_suspend_processing(), check CPU throttling last. That way if suspend_reason is CPU_THROTTLING, the GUI knows that there is no other source of suspension. 2013-08-13 14:16:18 -07:00
David Anderson 59ba61b323 client (Android): don't use network preferences
Many Android users had existing preferences with settings like
"don't compute when idle" that make sense for PCs but not mobile devices.
When this pref is enforced on Android, no computing happens
and user confusion results.
We're addressing this by using only local prefs on Android.
We considered other approaches - e.g. having a "mobile" venue -
but they're too complex.
2013-08-04 15:13:26 -07:00
David Anderson ba6fbc8071 client: if suspend for battery reasons, show parameters in event log
E.g., if suspend because battery temperature,
show current temperature and temperature limit.
Could do this for other things too, e.g. exclusive apps.
2013-07-13 16:31:25 -07:00
David Anderson 37eb54f12f client (Android): get "user active" from GUI; don't run if user active
On Android, get the "user active" state from the GUI
(as DEVICE_STATUS::user_active).
Never compute if user active (ignore preferences).
2013-06-22 09:58:39 -07:00
David Anderson 57a6d3d17a client (Android): make max battery temperature a preference
Note: internal change only; there's no GUI for this yet
2013-06-20 21:47:34 -07:00
David Anderson 846b8c7757 all components: change strcpy() to strlcpy() when possible.
This commit should cover the client and manager code.
2013-06-03 20:24:48 -07:00
David Anderson da4432a8c0 client: fix Android build breaks 2013-05-22 23:42:58 -07:00
David Anderson 078087985c client: add battery_charge_min_pct preference (currently for Android) 2013-05-21 10:26:45 -07:00
David Anderson 61913b181f client (Android): GUI reports battery and wifi status to client
Previously the client had (C++) code to
- check whether on AC or USB power
- get battery status and temperature
- check whether on wifi
These functions looked in various places under /sys.
Problem: the paths are system-dependent,
so whatever we do won't work on all devices.

The Android APIs for getting this info are in Java,
so we can't call them from the client.

Solution: have the GUI periodically get this info
and report it to the client via a GUI RPC.
The GUI must make this RPC periodically:
if the client doesn't get one within some period of time
(currently 30 sec) it suspends computing and network.

Also: if suspending jobs because of battery charge level
or temperature, leave them in memory.
2013-05-14 12:28:09 -07:00
David Anderson 64d7fa3474 - client: more fixes to GUI RPC addition.
Also, replace get_project_dir() with a memoized member function of PROJECT
2013-04-18 13:57:33 -07:00
David Anderson 1b9ad86694 - client: don't prefix <task> messages with [task] 2013-04-02 12:31:32 -07:00
David Anderson 5c7f583e42 - client: suspend_reason is not a bitmap; fix code that acted like it is. 2013-03-05 16:39:36 +01:00
Rom Walton 255fbade62 client: Fix typo for Android builds 2013-03-05 16:38:41 +01:00
David Anderson 6352f9ca9d - client (Android): forget hysteresis policy; don't compute if < 95% charged. 2013-03-05 16:34:58 +01:00
Rom Walton af7948910e client: Adjust logging on Android so that all messages that show up in the event log are also dumped to LogCat, things were originally setup with that intent but I don't think __VA_ARGS__ was having the desired effect. 2013-03-05 15:57:34 +01:00
Rom Walton d2df80a859 client: Fix typos for Android 2013-03-05 15:40:04 +01:00
Rom Walton 22a2762622 client: Fix build break on Android 2013-03-05 15:40:04 +01:00
David Anderson 21f580d9ef - client (Android): suspend processing if battery temperature > 45 C.
We can adjust this or make it configurable later.
2013-03-05 15:28:00 +01:00
David Anderson 607060ffaa - client (Android)
- Don't compute if the battery is overheated
    - Don't compute until the batter is 95% charged.
        Then stop computing if it falls below 90%.
        (On some devices, computing causes the batter to drain
        even while it's recharging).
2013-03-05 15:24:01 +01:00
David Anderson 4eed4c1b7d - client: message tweak
- remote job submission: output file fetch now working.  Woo hoo!
2013-03-05 14:52:37 +01:00
David Anderson d013b1f74a - Client: message tweak for GPU suspend/resume 2013-03-05 14:26:49 +01:00
David Anderson c17d20ccd9 - client: show sysmon messages correctly.
This was supposed to be in my 507cd79 commit, but it got botched somehow.
- client: the <task> debug flag enables suspend/resume messages
    for both CPU and GPU.
    Previously CPU messages were always shown,
    and GPU messages were shown if <cpu_sched_debug> was set.
- client: fix bug where reschedule wasn't being done on GPU suspend or resume.
2013-03-05 14:05:04 +01:00
David Anderson e8d6c33fe1 - user web: fix security vulnerabilities
- client: show available disk space correctly on startup
2013-03-04 17:39:24 +01:00
David Anderson 9cf10b400a - GUI RPC: expose TIME_STATS info (e.g. on_frac) in
the binding of the get_state() RPC
- client: move client_start_time and previous_uptime
    from CLIENT_STATE to TIME_STATS,
    so that these are also visible in GUI RPC
- scheduler RPC: move uptime and previous_uptime
    into <time_stats>
- client: condition an RR simulation message on <rrsim_detail>
- boinccmd: show TIME_STATS info in --get_state
2013-03-01 16:08:52 +01:00
David Anderson b9f138b4f4 - client: message tweak
svn path=/trunk/boinc/; revision=26129
2012-09-20 06:51:01 +00:00
David Anderson e79d3ea4c8 - client: change the way project disk share is computed.
- Allow projects to report "desired disk usage" (DDU).
        If the client learns that a project wants disk space,
        it can shrink the allocation to other projects.
    - Base share computation on DDU rather than disk usage.
    - Introduce the notion of "disk resource share".
        This is defined (somewhat arbitrarily) as resource share
        plus 1/10 of the largest resource share.
        This is intended to ensure that even zero-share projects
        get enough disk space to store app versions and data files;
        otherwise they wouldn't be able to compute.
- server: use host.d_boinc_max (which wasn't being used)
    to start d_project_share reported by client.
- volunteer storage: change the way hosts are allocated to chunks.
    Allow hosts to store several chunks of the same file, if needed


svn path=/trunk/boinc/; revision=26052
2012-08-22 04:02:52 +00:00
David Anderson 22f93cf009 - Client: initial checkin for Android version. From Joachim Fritzsch.
svn path=/trunk/boinc/; revision=25982
2012-08-04 00:27:32 +00:00
David Anderson bbfbef0fe8 - client: code cleanup. Move RESULT and PROJECT to separate files
svn path=/trunk/boinc/; revision=25621
2012-04-30 21:00:28 +00:00
David Anderson 643c731411 - client: if we're contacting a project to ask it for work
of a particular processor type,
    ask it for work of other types only if we're below
    max buffer for those types.


svn path=/trunk/boinc/; revision=25589
2012-04-20 23:51:20 +00:00
David Anderson b07ce4aebb - client: add <suspend_debug> log flag
svn path=/trunk/boinc/; revision=25586
2012-04-20 18:50:10 +00:00