BTT uses a bit too much CPU?

I am noticing a bit elevated CPU usage from BTT.
Screenshot 2023-10-24 at 13.50.46

Open files:

/
/Applications/BetterTouchTool.app/Contents/MacOS/BetterTouchTool
/System/Library/Frameworks/CFNetwork.framework/Versions/A/Resources/Localizable.loctable
/System/Library/CoreServices/SystemVersion.bundle/English.lproj/SystemVersion.strings
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/FauxVibrantDark.car
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/InputManager.loctable
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/DictationManager.loctable
/private/var/db/analyticsd/events.allowlist
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/MenuCommands.loctable
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Document.loctable
/usr/lib/libobjc-trampolines.dylib
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Common.loctable
/System/Library/Caches/com.apple.IntlDataCache.le.kbdx
/System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/InfoPlist.loctable
/System/Library/Input Methods/TCIM.app/Contents/PlugIns/TCIM_Extension.appex/Contents/Resources/InfoPlist.loctable
/System/Library/CoreServices/System Events.app/Contents/Resources/InfoPlist.loctable
/Applications/BetterTouchTool.app/Contents/Resources/Assets.car
/Users/my-user-name/Library/Application Support/BetterTouchTool/btt_data_store.version_4_271_build_42712-shm
/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app/Contents/Resources/en.lproj/InfoPlist.strings
/Applications/BetterTouchTool.app/Contents/Frameworks/MIKMIDI.framework/Versions/A/MIKMIDI
/Applications/BetterTouchTool.app/Contents/Frameworks/LetsMove.framework/Versions/A/LetsMove
/Applications/BetterTouchTool.app/Contents/Frameworks/BTTPluginSupport.framework/Versions/A/BTTPluginSupport
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSColorPanel.loctable
/Applications/BetterTouchTool.app/Contents/Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder
/Applications/BetterTouchTool.app/Contents/Frameworks/Ensembles.framework/Versions/A/Ensembles
/Library/Preferences/Logging/.plist-cache.vT2yP0uN
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/ControlStripAppearance.car
/Applications/BetterTouchTool.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle
/usr/share/icu/icudt72l.dat
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAqua.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantDark.car
/private/var/db/mds/messages/501/se_SecurityMessages
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/FauxVibrantLight.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantLight.car
/Applications/BetterTouchTool.app/Contents/Resources/BTT-icon6.tiff
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSColorPanelExtras.loctable
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSColorPickerSliders.loctable
/Applications/BetterTouchTool.app/Contents/Resources/BTTFloatingHTML.storyboardc/NSWindowController-xze-ZD-QQU.nib
/System/Library/PrivateFrameworks/MarkupUI.framework/PlugIns/Markup.appex/Contents/Resources/InfoPlist.loctable
/System/Library/PrivateFrameworks/SFSymbols.framework/Versions/A/Resources/CoreGlyphs.bundle/Contents/Resources/Assets.car
/System/Library/Fonts/SFNS.ttf
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/Aqua.car
/System/Library/Fonts/Helvetica.ttc
/System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/AppleKeyboardLayouts-L.dat
/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib
/System/Library/Frameworks/Foundation.framework/Versions/C/Resources/FoundationErrors.loctable
/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app/Contents/Resources/en.lproj/ServicesMenu.strings
/System/Library/Fonts/LastResort.otf
/System/Library/Frameworks/FileProvider.framework/OverrideBundles/FileProviderOverride.bundle/Contents/MacOS/FileProviderOverride
/System/Library/Frameworks/FileProvider.framework/OverrideBundles/iCloudDriveFileProviderOverride.bundle/Contents/MacOS/iCloudDriveFileProviderOverride
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/FunctionRowAppearance.car
/System/Library/Frameworks/Security.framework/Versions/A/PlugIns/csparser.bundle/Contents/MacOS/csparser
/System/Library/Frameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.apple.WebPrivacy/QUERY_PARAM.wplist
/System/Library/CoreServices/Finder.app/Contents/Resources/InfoPlist.loctable
/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Resources/en.lproj/Localizable.stringsdict
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.apple.scriptmanager2.le.cache
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Base.lproj/NSTextTouchBarItems.nib
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.apple.WebPrivacy/ALLOWED_QUERY_PARAM.wplist
/System/Library/Input Methods/EmojiFunctionRowIM.app/Contents/PlugIns/EmojiFunctionRowIM_Extension.appex/Contents/Resources/InfoPlist.loctable
/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/Resources/DesignLibrary-macOS.bundle/Contents/Resources/macOSRepositories/DarkStandard.car
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSAppearanceNameCandidateBar.car
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/TextTouchBar.loctable
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Services.loctable
/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/Resources/DesignLibrary-macOS.bundle/Contents/Resources/macOSRepositories/LightStandard.car
/System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/Resources/ShareKit.loctable
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/Filters.loctable
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/Keys.loctable
/System/Library/Extensions/AMDRadeonX6000GLDriver.bundle/Contents/MacOS/AMDRadeonX6000GLDriver
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.hegenberg.BetterTouchTool/com.apple.metal/32023/libraries.data
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Assets.car
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/Assets.car
/System/Library/Fonts/SFCompact.ttf
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.hegenberg.BetterTouchTool/com.apple.metal/16777237_9765376/functions.data
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Placeholders.loctable
/Users/my-user-name/Library/HTTPStorages/com.hegenberg.BetterTouchTool/httpstorages.sqlite-shm
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSTouchBarReducedMetricsAppearance.car
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/TouchBar.loctable
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSTextTouchBarItems.loctable
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkGraphite.car
/private/var/db/nsurlstoraged/dafsaData.bin
/System/Library/Fonts/PingFang.ttc
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/0/com.apple.LaunchServices.dv/com.apple.LaunchServices-5019-v2.csstore
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/Descriptions.loctable
/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Resources/en.lproj/Localizable.strings
/System/Library/PrivateFrameworks/CoreNLP.framework/Versions/A/Resources/tokruleLE.data
/System/Library/LinguisticData/Latn/Dict2.dat
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Menus.loctable
/System/Library/LinguisticData/Latn/Dict1.dat
/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/Resources/com.apple.datadetectorscore.cache.urlifier.system
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Accessibility.loctable
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/AccessibilityImageDescriptions.loctable
/System/Library/Fonts/Keyboard.ttf
/System/Library/Components/AudioCodecs.component/Contents/MacOS/AudioCodecs
/usr/share/langid/langid.inv
/System/Library/Fonts/Apple Color Emoji.ttc
/dev/null
/dev/null
/dev/null
/Users/my-user-name/Library/Application Support/BetterTouchTool/Logs/com.hegenberg.BetterTouchTool 2023-10-22--06-55-03-711.log
/Users/my-user-name/Library/Application Support/BetterTouchTool/btt_data_store.version_4_271_build_42712
/Users/my-user-name/Library/Application Support/BetterTouchTool/btt_data_store.version_4_271_build_42712-wal
/Users/my-user-name/Library/Application Support/BetterTouchTool/btt_data_store.version_4_271_build_42712-shm
->0xe0a01b208e3e204b
*:*
/Users/my-user-name/Library/HTTPStorages/com.hegenberg.BetterTouchTool/httpstorages.sqlite
/Users/my-user-name/Library/HTTPStorages/com.hegenberg.BetterTouchTool/httpstorages.sqlite-wal
/Users/my-user-name/Library/HTTPStorages/com.hegenberg.BetterTouchTool/httpstorages.sqlite-shm
->0xe0a01b208e3e3fe3
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.hegenberg.BetterTouchTool/com.apple.metal/32023/libraries.data
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_stdlib.metallib
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_filters.metallib
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_stdlib_stitchable.metallib
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_filters_stitchable.metallib
/System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/Frameworks/MPSImage.framework/Versions/A/Resources/default.metallib
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.hegenberg.BetterTouchTool/com.apple.metal/32023/libraries.list
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.hegenberg.BetterTouchTool/com.apple.metal/16777237_9765376/functions.data
/private/var/folders/6x/y97363x167qb9kccbvwv237r0000gn/C/com.hegenberg.BetterTouchTool/com.apple.metal/16777237_9765376/functions.list

@Andreas_Hegenberg - anything I can do to further help debug this?
It lags my laptop (notice how MAMP already uses half of the CPU, which is unfortunate but nothing new. Having the "background" helper BTT using up almost the entire other half is suboptimal.)

that's way too much unless you are actively doing stuff in the BTT configuration UI.
Do you have the experimental dropbox/icloud sync enabled maybe?

In general BTT should never go above 5% during normal usage, usually should stay between 0-3%

However note: this does not mean MAMP is using half of your CPU. The percentages only relate to one core of your CPU (a 10 core CPU can go up to 1000% in total). But still wondering, what are you doing with your MAMP? This is still some pretty heavy load.

Could you run this terminal command and send the resulting btt_sample.txt to me (andreas@folivora.ai)?

sample BetterTouchTool -file ~/Desktop/btt_sample.txt

I thought as well :sweat_smile:

  1. No remote sync active (dropbox, etc)
  2. "But still wondering, what are you doing with your MAMP?"
    .... Running a few WP DEV websites. That thing never run lower than 40%, since I use it. I think it might be related to having several (about 20) hosts. Not sure though, because I recall usually Macs going all tornado as soon MAMP is activated, since I use it.
  3. "Could you run this terminal command and send the resulting btt_sample.txt to me "
    Sent!

Thanks!

Uhm... This might be one of my messy BTT Scripts

  1. I quit BTT
  2. Magically MAMP usage goes down too
  3. Remembers this dude has script in BTT that checks if mamp is active, running, if so, makes a button green instead of grey on the touchbar.

This might just be the bit that I should disable. Will check and feedback.

MAMP should absolutely not use more than 1-2% for this if I understood your setup correctly.

Which version of BTT is this? // edit: ah sorry the sample contains the version

1 Like

It's weird.

I quit both BTT, and MAMP, and restarted both
BTT now runs at 1.5% (seems very ok to me)
MAMP is still between 18% to 30% (but at this level the fans do not go nuts, so I would not even realise it if not looking at the task manager)
As said as I recall MAMP always was a bit of a heavy thing, since I use it. Not sure if running apache + nginx simoultanously is a factor. I never considered it strange - just assumed "well, it runs a server" and was happy it worked.

In any case, it seems BTT usage is back down to normal. Strange - I wonder what might have been happening here (PS the scripts that check MAMP status still are active. All I did was a quit-restart the apps)

But:
I can definitely confirm that as soon I disable BTT (quit it) MAMP consumption goes down to 0.2%

So I will have to look at those scripts.

It is an apple script, stored in the BTT settings for a global button:

if application "MAMP PRO" is running then
	menuItemClick({"MAMP PRO", "Tools", "Stop servers"})
else
	return ""
end if
on menuItemClick({appName, menuName1, menuItem1})
	
	tell application "System Events"
		
		tell application process appName
			
			if menu item menuItem1 of menu 1 of menu bar item menuName1 of menu bar 1 exists then
				
				return "is active"
				
			else
				
				return "is not active"
				
			end if
			
		end tell
		
	end tell
	
end menuItemClick

Set to "run in background", ever 1 second.

And I have that for 4 buttons (each a distinct task for MAMP), because each of them has to be green if mamp is running, otherwise my OCD is hurt.

unfortunately I seem to have cleaned up a bit too much recently and lost the files required to symbolicate your sample (they are always specific to a BTT version).
If this happens again, you might need to upgrade to the latest alpha and run the sample command again, then I can probably see what is happening.

However, 18-30% for MAMP is still too much. For example the server that handles all BTT update check requests (which are something like 500-1000 per second) always hovers at 1-5% CPU usage.

See my above reply I was editing while you replied

The cause is not BTT directly, but a script I run in it.

Not "your" fault I would say :stuck_out_tongue:
I guess I will have to work on my OCD and remove that button background.

Querying the menubar can be quite expensive, depending on the app's implementation.

Are there maybe better ways to check that? Maybe by querying some local URL or pinging? (I don't have a lot of experience with MAMP)

1 Like

I think I could just remove it. The whole purpose of the script is (apart of actually doing an action in MAMP when pressing the TB Button), is the set the buttons backgrounds to green when MAMP is active, or grey when not.
And as I do not like to wait - I set it to a 1 second interval

But I can imagine, that this running 4 times, every single second, is probably not optimal in any case.
I rarely use the buttons anyway, I think I will just remove them.

Sorry the noise, this definitely seems user-error.

1 Like

When I set this up I recall having to struggle for some hours between StackOverflow, trial and error, etc... GPT made a more performant approach in its usual 5 seconds

So instead of above script to check activity status...

set serverStatus to do shell script "nc -z localhost 80 > /dev/null; echo $?"

if serverStatus is "0" then
	return "is active"
else
	return "is not active"
end if

CPU Usage down to 0.1%

nice!