Skip to content

Conversation

jamescowens
Copy link
Member

This is a port of the Bitcoin MacOS app nap manager.

In our port, the triggers for app nap disable are a bit different. Here, if app nap is only enabled if not staking and not out of sync.

@jamescowens jamescowens marked this pull request as draft December 24, 2020 21:38
@jamescowens jamescowens added this to the Hilda milestone Dec 24, 2020
@jamescowens jamescowens changed the title Port Bitcoin MacOS app nap manager gui: Port Bitcoin MacOS app nap manager Dec 25, 2020
@jamescowens
Copy link
Member Author

@scribblemaniac was gracious enough to run testing on this to see if it worked. I am providing three files here containing the output from getmininginfo representing three runs. Each run represents one hour of runtime with a wallet with one UTXO of 5000.00 GRC. The new metric staking_loop_efficiency shows the ratio of the number of 16-sec quantum (masked) staking intervals covered by the miner compared to the number of intervals since wallet startup. Since this test wallet is unencrypted, this should be near or at 100%.
getmininginfo_appnap_active_without_appnap_disable_commit.txt
getmininginfo_appnap_not_active_without_appnap_disable_commit.txt
getmininginfo_appnap_active_with_appnap_disable_commit.txt

Notice the first file, where app nap is active and the app nap disable commit is not present, the staking loop efficiency is 79.6%, which means that staking is significantly impacted. The second file, where the application is in the foreground, but the app nap disable commit is not present, the efficiency is 100%. For the third run, the app nap commit above is applied, and the application window is completely obscured by other windows, meeting the conditions for app nap to activate again. This time the efficiency remains at 100%. I deem this test successful!

@jamescowens jamescowens marked this pull request as ready for review December 25, 2020 02:12
@jamescowens jamescowens self-assigned this Dec 26, 2020
@jamescowens jamescowens requested a review from div72 December 26, 2020 21:46
@div72
Copy link
Member

div72 commented Dec 27, 2020

utACK

@jamescowens
Copy link
Member Author

I am going to go ahead and merge it. Looks like it works based on Scribblemaniac's tests.

@jamescowens jamescowens merged commit 7b07e51 into gridcoin-community:development Dec 27, 2020
@jamescowens jamescowens deleted the appnap branch January 4, 2021 00:27
jamescowens added a commit that referenced this pull request Mar 1, 2021
 Added
 - gui: Add RAC column to wizard summary page projects table #1951 (@cyrossignol)
 - rpc: clean up the superblocks function and add magnitude to getmininginfo #1966 (@jamescowens)
 - rpc: Add transaction size to RPC output #1971 (@cyrossignol)
 - voting: Add user-facing support for poll response types #1976 (@cyrossignol)
 - gui: Port Bitcoin Intro class (implement the ability to choose a data directory via the GUI) #1978 (@jamescowens)
 - gui: Port Bitcoin MacOS app nap manager #1991 (@jamescowens)
 - mining, rpc: Implement staking efficiency measure and improve SelectCoinsForStaking and CreateCoinStake #1992 (@jamescowens)
 - accrual, rpc: Implement auditsnapshotaccruals #2001 (@jamescowens)
 - docs: add doxygen support #2000 (@div72)
 - beacon: Specialized beacon storage in leveldb #2009 (@jamescowens)
 - rpc: Add a call to dump contracts in binary form #2011 (@div72)
 - rpc: Add boolean option to report active beacons only in beaconreport #2013 (@jamescowens)
 - consensus: Set Hilda mainnet hardfork height to 2197000 #2022 (@jamescowens)

 Changed
 - refactor: [Memory optimization] Block index duplicate PoS state #1945 (@cyrossignol)
 - refactor: [Memory optimization] Block index superblock and contract flags #1950 (@cyrossignol)
 - refactor: [Memory optimization] Remove stake modifier checksums #1954 (@cyrossignol)
 - refactor: [Memory optimization] Block index allocation overhead #1957 (@cyrossignol)
 - refactor: [Memory optimization] Remove block index subsidy fields #1960 (@cyrossignol)
 - refactor: [Memory optimization] Separate chain trust from the block index #1961 (@cyrossignol)
 - refactor: [Memory optimization] Eliminate padding between block index fields #1962 (@cyrossignol)
 - beacon, gui: Add check for presence of beacon private key to updateBeacon() #1968 (@jamescowens)
 - util: Enhance ETTS calculation #1973 (@jamescowens)
 - refactor: Use new clamp in util.h #1975 (@jamescowens)
 - gui: Redo global status for overview #1983 (@jamescowens)
 - util: Improvements to MilliTimer class and use in the miner and init #1987 (@jamescowens)
 - rpc: Move rpc files to directory #1995 (@Pythonix)
 - rpc: Enhance consolidateunspent and fix fee calculation #1994 (@jamescowens)
 - contract: Double the lookback scope of contract replay #1998 (@jamescowens)
 - net: Don't rely on external IP resolvers #2002 (@Tetrix42)
 - beacon: Change beacon map to pointers #2008 (@jamescowens)
 - gui: Update bitcoin_sv.ts #2014 (@sweede-se)
 - util: Update snapshot URLs and add accrual directory #2019 (@jamescowens)
 - beacon: Tweak BeaconRegistry::Revert #2020 (@jamescowens)
 - rpc, qt: bump fees @2023 (@div72)

 Removed
 - researcher: Remove automatic legacy beacon key import #1963 (@cyrossignol)
 - util: Revert "Close LevelDB after loading the block index" #1969 (@cyrossignol)
 - ci: Fix python symlink issue & remove travis #1990 (@div72)
 - ci: remove python workaround #2005 (@div72)

 Fixed
 - gui: fix mandatory/leisure detection of upgrade check #1959 (@Pythonix)
 - voting: Fix title in "gettransaction" RPC for legacy poll contracts @1970 (@cyrossignol)
 - gui: Fix missing menu items on macOS #1972 (@scribblemaniac)
 - rpc: Fix answer offset in "votedetails" #1974 (@cyrossignol)
 - voting: Implement missing try-catch in VotingVoteDialog::vote #1980 (@jamescowens)
 - scraper: Add check for minimum housekeeping complete in scraper #1977 (@jamescowens)
 - voting: Fix nonsense vote weights for legacy polls #1988 (@cyrossignol)
 - voting: Fix incorrect field returned in ResolveMoneySupplyForPoll() #1989 (@cyrossignol)
 - consensus, accrual: Fix newbie accrual #2004 (@jamescowens)
 - log: grammar correction #2016 (@nathanielcwm)
 - wallet: Correct nMinFee fee calculation in CreateTransaction #2021 (@jamescowens)
 - rpc, miner: Correct GetLastStake #2026 (@jamescowens)
 - wallet: Fix bug in CreateTransaction causing insufficient fees #2029 (@jamescowens)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants