Skip to content

Commit

Permalink
fix max number of cores
Browse files Browse the repository at this point in the history
  • Loading branch information
trulyspinach committed Feb 27, 2020
1 parent bec2068 commit 0e403f1
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 35 deletions.
63 changes: 42 additions & 21 deletions AMD Power Gadget/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="AMD_Power_Gadget" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<view key="view" appearanceType="darkAqua" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="410" height="940"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
Expand All @@ -721,18 +721,16 @@
<rect key="frame" x="0.0" y="0.0" width="388" height="925"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YXN-KS-nxl">
<rect key="frame" x="18" y="866" width="298" height="39"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YXN-KS-nxl">
<rect key="frame" x="18" y="867" width="298" height="38"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="AMD Power Gadget" id="kgx-Yz-PbY">
<font key="font" size="27" name="HelveticaNeue-Bold"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dUS-mw-nYz" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
<rect key="frame" x="20" y="596" width="368" height="241"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="dUS-mw-nYz" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
<rect key="frame" x="20" y="596" width="368" height="242"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jld-SV-yGS">
<rect key="frame" x="18" y="202" width="298" height="27"/>
Expand Down Expand Up @@ -798,9 +796,8 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TFs-yj-lzu" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
<customView translatesAutoresizingMaskIntoConstraints="NO" id="TFs-yj-lzu" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
<rect key="frame" x="20" y="336" width="368" height="241"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Qhw-g2-Ry1">
<rect key="frame" x="18" y="202" width="298" height="27"/>
Expand Down Expand Up @@ -866,9 +863,8 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dVq-Zt-29Y" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
<customView translatesAutoresizingMaskIntoConstraints="NO" id="dVq-Zt-29Y" customClass="GraphView" customModule="AMD_Power_Gadget" customModuleProvider="target">
<rect key="frame" x="20" y="76" width="368" height="241"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p3e-V6-tG5">
<rect key="frame" x="18" y="202" width="298" height="27"/>
Expand Down Expand Up @@ -934,18 +930,20 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lW7-TH-Jh4">
<rect key="frame" x="18" y="849" width="372" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="AMD Ryzen 9 3900X n-Core Processor" id="dkz-Wd-dhY">
<font key="font" size="16" name="HelveticaNeue-Bold"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lW7-TH-Jh4">
<rect key="frame" x="18" y="846" width="372" height="29"/>
<constraints>
<constraint firstAttribute="height" constant="29" id="6C3-hR-dsW"/>
<constraint firstAttribute="width" constant="368" id="bUD-fi-qGW"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" alignment="left" title="AMD Ryzen 9 3900X n-Core Processor" id="dkz-Wd-dhY">
<font key="font" size="15" name="HelveticaNeue-Bold"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zyk-cy-OHd">
<rect key="frame" x="143" y="20" width="103" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zyk-cy-OHd">
<rect key="frame" x="155" y="25" width="79" height="16"/>
<buttonCell key="cell" type="bevel" title="trulyspinach" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="Mcz-UE-trr">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -955,16 +953,39 @@
<action selector="buttonPressed:" target="XfG-lQ-9wD" id="64Z-nc-FX5"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tU5-xZ-Nqc">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tU5-xZ-Nqc">
<rect key="frame" x="103" y="43" width="183" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Designed and Engineered By:" id="j0C-AZ-HUC">
<font key="font" metaFont="system"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="trailing" secondItem="dUS-mw-nYz" secondAttribute="trailing" id="2VD-4R-hRQ"/>
<constraint firstItem="zyk-cy-OHd" firstAttribute="top" secondItem="tU5-xZ-Nqc" secondAttribute="bottom" constant="2" id="6tT-DA-1CL"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="dVq-Zt-29Y" secondAttribute="leading" id="AWt-bz-fnf"/>
<constraint firstItem="dUS-mw-nYz" firstAttribute="top" secondItem="YXN-KS-nxl" secondAttribute="bottom" constant="29" id="Gjz-Jd-Mwt"/>
<constraint firstItem="YXN-KS-nxl" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="20" symbolic="YES" id="H5I-vD-bdX"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="YXN-KS-nxl" secondAttribute="leading" id="H5h-02-vM6"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="dUS-mw-nYz" secondAttribute="leading" id="KjU-TQ-odV"/>
<constraint firstItem="TFs-yj-lzu" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="348" id="QD2-7C-QSt"/>
<constraint firstItem="dVq-Zt-29Y" firstAttribute="top" secondItem="TFs-yj-lzu" secondAttribute="bottom" constant="19" id="THl-Lw-orm"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="trailing" secondItem="TFs-yj-lzu" secondAttribute="trailing" id="Wyh-vg-Hhw"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="TIX-Q5-kis" secondAttribute="leading" constant="20" symbolic="YES" id="Wzp-gX-th1"/>
<constraint firstItem="tU5-xZ-Nqc" firstAttribute="centerX" secondItem="zyk-cy-OHd" secondAttribute="centerX" id="YFk-qA-lD9"/>
<constraint firstItem="tU5-xZ-Nqc" firstAttribute="top" secondItem="dVq-Zt-29Y" secondAttribute="bottom" constant="17" id="Zu6-eZ-KuA"/>
<constraint firstAttribute="bottom" secondItem="dVq-Zt-29Y" secondAttribute="bottom" constant="76" id="ZyT-Zt-PRq"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="leading" secondItem="TFs-yj-lzu" secondAttribute="leading" id="efh-Qa-okv"/>
<constraint firstAttribute="trailing" secondItem="YXN-KS-nxl" secondAttribute="trailing" constant="74" id="hqb-jw-Oyu"/>
<constraint firstItem="dUS-mw-nYz" firstAttribute="top" secondItem="lW7-TH-Jh4" secondAttribute="bottom" constant="8" id="ihb-nE-2b9"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="trailing" secondItem="dVq-Zt-29Y" secondAttribute="trailing" id="tRv-jb-fPd"/>
<constraint firstItem="tU5-xZ-Nqc" firstAttribute="centerX" secondItem="TIX-Q5-kis" secondAttribute="centerX" id="xEB-Bl-cM3"/>
<constraint firstItem="TFs-yj-lzu" firstAttribute="top" secondItem="dUS-mw-nYz" secondAttribute="bottom" constant="19" id="xWY-Ya-zkB"/>
<constraint firstItem="lW7-TH-Jh4" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="50" id="xy4-YI-iUL"/>
<constraint firstItem="dVq-Zt-29Y" firstAttribute="top" secondItem="TIX-Q5-kis" secondAttribute="top" constant="608" id="yg4-w2-cFI"/>
</constraints>
</view>
</subviews>
</clipView>
Expand Down
2 changes: 1 addition & 1 deletion AMD Power Gadget/GraphView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GraphView: NSView {
let gridDivLines: [Double] = [0, 0.15, 0.25, 0.35, 0.5, 0.6, 0.8, 1]
let maxDataPoints = 30

let dummyData: [Double] = [1,3,3,2, 9, 1, 2 ,3]
let dummyData: [Double] = [1,3,2]
// let dummyData: [Double] = [1,1,1,3,2 ,1]


Expand Down
4 changes: 2 additions & 2 deletions AMD Power Gadget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
5 changes: 3 additions & 2 deletions AMD Power Gadget/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ class ViewController: NSViewController, NSWindowDelegate {
var numberOfCores: UInt64 = 0
var outputCount: UInt32 = 1

var outputStr: [Float] = [Float](repeating: 0, count: 32)
var outputStrCount: Int = 4 * 64
let maxStrLength = 66 //MaxCpu + 2
var outputStr: [Float] = [Float](repeating: 0, count: maxStrLength)
var outputStrCount: Int = 4 * maxStrLength
let res = IOConnectCallMethod(connect, 4, nil, 0, nil, 0,
&numberOfCores, &outputCount,
&outputStr, &outputStrCount)
Expand Down
16 changes: 12 additions & 4 deletions SMCAMDProcessor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,14 @@
CODE_SIGN_ENTITLEMENTS = "AMD Power Gadget/AMD_Power_Gadget.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
INFOPLIST_FILE = "AMD Power Gadget/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = "wtf.spinach.AMD-Power-Gadget";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
Expand All @@ -272,11 +275,14 @@
CODE_SIGN_ENTITLEMENTS = "AMD Power Gadget/AMD_Power_Gadget.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
INFOPLIST_FILE = "AMD Power Gadget/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = "wtf.spinach.AMD-Power-Gadget";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down Expand Up @@ -399,7 +405,7 @@
buildSettings = {
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.0.1d1;
CURRENT_PROJECT_VERSION = 1.1;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -412,7 +418,8 @@
);
INFOPLIST_FILE = SMCAMDProcessor/Info.plist;
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Lilu.kext/Contents/Resources/Library";
MARKETING_VERSION = 1.0.1d1;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.1;
MODULE_NAME = wtf.spinach.SMCAMDProcessor;
MODULE_VERSION = 1.0.0d1;
OTHER_CPLUSPLUSFLAGS = "-Wno-inconsistent-missing-override";
Expand All @@ -428,7 +435,7 @@
buildSettings = {
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.0.1d1;
CURRENT_PROJECT_VERSION = 1.1;
GCC_PREPROCESSOR_DEFINITIONS = (
"PRODUCT_NAME=$(PRODUCT_NAME)",
"MODULE_VERSION=$(MODULE_VERSION)",
Expand All @@ -439,7 +446,8 @@
);
INFOPLIST_FILE = SMCAMDProcessor/Info.plist;
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Lilu.kext/Contents/Resources/Library";
MARKETING_VERSION = 1.0.1d1;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.1;
MODULE_NAME = wtf.spinach.SMCAMDProcessor;
MODULE_VERSION = 1.0.0d1;
OTHER_CPLUSPLUSFLAGS = "-Wno-inconsistent-missing-override";
Expand Down
5 changes: 1 addition & 4 deletions SMCAMDProcessor/SMCAMDProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ void SMCAMDProcessor::updatePackageTemp(){
// Offset table: https://github.com/torvalds/linux/blob/master/drivers/hwmon/k10temp.c#L78
uint32_t totalNumberOfPhysicalCores = cpuTopology.totalPhysical();


if(tempOffsetFlag) {
if (totalNumberOfPhysicalCores == 6) // 1600X,1700X,1800X
offset = -20.0f;
Expand All @@ -274,12 +273,10 @@ void SMCAMDProcessor::updatePackageTemp(){
else if (totalNumberOfPhysicalCores == 12 || totalNumberOfPhysicalCores == 32) // TR1900,2900
offset = -27.0f;


if (tempOffsetFlag && (kF17H_TEMP_OFFSET_FLAG != 0))
if (tempOffsetFlag)
t += -49.0f;
}


if (offset < 0)
t += offset;

Expand Down
Loading

0 comments on commit 0e403f1

Please sign in to comment.