![]() |
|
|
#45 |
|
If I May
"Chris Halsall"
Sep 2002
Barbados
9,767 Posts |
|
|
|
|
|
|
#46 |
|
Romulan Interpreter
Jun 2011
Thailand
72·197 Posts |
@KingKurly:
|
|
|
|
|
|
#47 |
|
"Mike"
Aug 2002
2·23·179 Posts |
12.04 LTS:
Code:
$ gcc -ansi -Wall test.c test.c: In function ‘onBattery’: test.c:40:25: warning: implicit declaration of function ‘strstr’ [-Wimplicit-function-declaration] test.c:40:29: warning: incompatible implicit declaration of built-in function ‘strstr’ [enabled by default] test.c:51:17: warning: implicit declaration of function ‘atoi’ [-Wimplicit-function-declaration] $ ./a.out AC |
|
|
|
|
|
#48 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
If the file in /sys/ is opened, then his function is guaranteed to return and not check /proc/. This isn't normally an issue, but as chalsall himself told me, handling the errors is the hard part
![]() (You never know if you might open a corrupted file or something silly )
|
|
|
|
|
|
#49 | |
|
If I May
"Chris Halsall"
Sep 2002
Barbados
9,767 Posts |
Quote:
Since /sys/ is a virtual file system, opening a "corrupted" file in such a situation would mean you've got much bigger issues on your hands than possibly mis-detecting if you're on AC or battery.... |
|
|
|
|
|
|
#50 |
|
Sep 2010
Annapolis, MD, USA
2758 Posts |
Odd observations from my stepfather's laptop... it was upgraded to Ubuntu 12.04 LTS not too long ago. For /sys/class/power_supply/AC/online it uses ACAD instead of AC. And for /proc/acpi/battery/BAT0/state it has BAT1 instead of BAT0.
A few problems here. First, the old code wouldn't work on his laptop. Second, the new code wouldn't work either. Hrmm... what the heck? The kernel was 3.2.0-24-generic. Can anyone else confirm these findings? (Look in /sys/class/power_supply and /proc/acpi/battery) Edit: I don't think it's a safe assumption that the contents of /proc/acpi/battery/BAT0/state are smaller than 180 bytes. Is the code not making that assumption? (I'm mildly rusty on my C.) Last fiddled with by KingKurly on 2012-06-01 at 03:55 Reason: Additional problem |
|
|
|
|
|
#51 |
|
Aug 2002
Termonfeckin, IE
22·691 Posts |
A feature request. I like the newer version of throttle where you specify the percent of time you want to be running. In Multi core systems where memory may be a bottleneck is it possible to stagger the periods of rest between cores? So if I am running 50 throttle I want one core to be running Prime95 half the time and the other core for the rest. Right now both cores run together and rest together.
|
|
|
|
|
|
#52 |
|
Sep 2010
Annapolis, MD, USA
33·7 Posts |
A friend of mine took a look at the battery detection code and came up with this rendition: https://gist.github.com/60de973a8289...comment-338482
I haven't yet checked how often the battery gets polled... that makes quite a difference in how this should be done. To sleep, for me. |
|
|
|
|
|
#53 | |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
722110 Posts |
Quote:
|
|
|
|
|
|
|
#54 | |
|
"Mike"
Aug 2002
2×23×179 Posts |
Quote:
|
|
|
|
|
|
|
#55 | |
|
Sep 2010
Annapolis, MD, USA
18910 Posts |
Quote:
Code:
./commonc.h:#define TE_BATTERY_CHECK_FREQ 15 /* Check battery every 15 sec. */ ./commonb.c: add_timed_event (TE_BATTERY_CHECK, TE_BATTERY_CHECK_FREQ); |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Prime95 version 27.3 | Prime95 | Software | 148 | 2012-03-18 19:24 |
| Prime95 version 26.3 | Prime95 | Software | 76 | 2010-12-11 00:11 |
| Prime95 version 25.5 | Prime95 | PrimeNet | 369 | 2008-02-26 05:21 |
| Prime95 version 25.4 | Prime95 | PrimeNet | 143 | 2007-09-24 21:01 |
| When the next prime95 version ? | pacionet | Software | 74 | 2006-12-07 20:30 |