Skip to content

Commit

Permalink
remove some other experimental profiling stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight committed Aug 11, 2023
1 parent da8cbee commit 2543034
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 132 deletions.
78 changes: 4 additions & 74 deletions Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="jya-5z-xKN">
<rect key="frame" x="0.0" y="64" width="320" height="140"/>
<rect key="frame" x="0.0" y="64" width="320" height="56"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="DOu-47-e6X">
<rect key="frame" x="93" y="0.0" width="134" height="28"/>
Expand Down Expand Up @@ -178,54 +178,8 @@
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="cUN-Lh-mGL">
<rect key="frame" x="74.5" y="28" width="171" height="28"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Izf-kp-3cx">
<rect key="frame" x="0.0" y="0.0" width="137" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Location updates start"/>
<connections>
<action selector="startGPSUpdates:" destination="NZr-bH-g9o" eventType="touchUpInside" id="sjB-U9-Xwz"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Zew-hW-Mn9">
<rect key="frame" x="137" y="0.0" width="34" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title=" / end"/>
<connections>
<action selector="endGPSUpdates:" destination="NZr-bH-g9o" eventType="touchUpInside" id="Etc-cn-U4x"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="m0X-j3-N5j">
<rect key="frame" x="75.5" y="56" width="169" height="28"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vLg-ta-caQ">
<rect key="frame" x="0.0" y="0.0" width="135" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Heading updates start"/>
<connections>
<action selector="startHeadingUpdates:" destination="NZr-bH-g9o" eventType="touchUpInside" id="L76-yl-Hh6"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Q8-OQ-zIc">
<rect key="frame" x="135" y="0.0" width="34" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title=" / end"/>
<connections>
<action selector="endHeadingUpdates:" destination="NZr-bH-g9o" eventType="touchUpInside" id="UAX-R2-aEZ"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="LqU-hQ-XGw">
<rect key="frame" x="97" y="84" width="126" height="28"/>
<rect key="frame" x="97" y="28" width="126" height="28"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="X23-2K-XhG">
<rect key="frame" x="0.0" y="0.0" width="92" height="28"/>
Expand All @@ -247,40 +201,16 @@
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="XBF-1v-xEP">
<rect key="frame" x="101.5" y="112" width="117" height="28"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WBg-BJ-XXl">
<rect key="frame" x="0.0" y="0.0" width="83" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Network start"/>
<connections>
<action selector="startNetworkWork:" destination="NZr-bH-g9o" eventType="touchUpInside" id="0zk-ap-Jfv"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lgg-4N-L4B">
<rect key="frame" x="83" y="0.0" width="34" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title=" / end"/>
<connections>
<action selector="endCPUWork" destination="NZr-bH-g9o" eventType="touchUpInside" id="iAg-Ya-zdG"/>
<action selector="endNetworkWork:" destination="NZr-bH-g9o" eventType="touchUpInside" id="kv9-iY-L9G"/>
</connections>
</button>
</subviews>
</stackView>
<textField hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="uTM-T7-Gv6">
<rect key="frame" x="0.0" y="140" width="320" height="0.0"/>
<rect key="frame" x="0.0" y="56" width="320" height="0.0"/>
<accessibility key="accessibilityConfiguration" identifier="io.sentry.benchmark.value-marshaling-text-field"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="hFG-bX-qLp">
<rect key="frame" x="10" y="258" width="300" height="159.5"/>
<rect key="frame" x="10" y="174" width="300" height="159.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Work threads:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t2C-jL-6qO">
<rect key="frame" x="97" y="0.0" width="106.5" height="20.5"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import CoreLocation
import UIKit

@available(iOS 13.0, *)
class ProfilingViewController: UIViewController, CLLocationManagerDelegate, UITextFieldDelegate {
class ProfilingViewController: UIViewController, UITextFieldDelegate {

@IBOutlet weak var workThreadLabel: UILabel!
@IBOutlet weak var workIntensityFactorLabel: UILabel!
@IBOutlet weak var minWorkIntensityLabel: UILabel!

@IBOutlet weak var workThreadSlider: UISlider!
@IBOutlet weak var workIntervalSlider: UISlider!
Expand Down Expand Up @@ -41,48 +39,6 @@ class ProfilingViewController: UIViewController, CLLocationManagerDelegate, UITe
print("[iOS-Swift] benchmarking results:\n\(value)")
}

var locationManager: CLLocationManager?
@IBAction func startGPSUpdates(_ sender: UIButton) {
highlightButton(sender)
defer { locationManager?.startUpdatingLocation() }
guard locationManager == nil else { return }
locationManager = CLLocationManager()
locationManager?.delegate = self
}

@IBAction func endGPSUpdates(_ sender: UIButton) {
highlightButton(sender)
locationManager?.stopUpdatingLocation()
locationManager = nil
}

@IBAction func startHeadingUpdates(_ sender: UIButton) {
highlightButton(sender)
defer { locationManager?.startUpdatingHeading() }
guard locationManager == nil else { return }
locationManager = CLLocationManager()
locationManager?.delegate = self
}

@IBAction func endHeadingUpdates(_ sender: UIButton) {
highlightButton(sender)
locationManager?.stopUpdatingHeading()
locationManager = nil
}

var networkScanner: ProfilingNetworkScanner?
@IBAction func startNetworkWork(_ sender: UIButton) {
highlightButton(sender)
guard networkScanner == nil else { return }
networkScanner = ProfilingNetworkScanner()
networkScanner?.start()
}

@IBAction func endNetworkWork(_ sender: UIButton) {
highlightButton(sender)
networkScanner?.end()
}

@IBAction func startCPUWork(_ sender: UIButton) {
highlightButton(sender)
_adjustWorkThreadsToCurrentRequirement()
Expand Down Expand Up @@ -122,16 +78,6 @@ class ProfilingViewController: UIViewController, CLLocationManagerDelegate, UITe
view.backgroundColor = .init(white: CGFloat(sender.value), alpha: 1)
}

// MARK: CLLocationManagerDelegate

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
print("locations: \(locations)")
}

func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) {
print("headings: \(newHeading)")
}

// MARK: UITextFieldDelegate

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
Expand All @@ -148,7 +94,6 @@ class ProfilingViewController: UIViewController, CLLocationManagerDelegate, UITe
if diff == 0 {
return
} else if diff > 0 {
// print("creating \(diff) threads")
for _ in 0 ..< diff {
let thread = WorkThread()
thread.qualityOfService = .userInteractive
Expand All @@ -157,7 +102,6 @@ class ProfilingViewController: UIViewController, CLLocationManagerDelegate, UITe
}
} else {
let absDiff = abs(diff)
// print("removing \(absDiff) threads")
for _ in 0 ..< absDiff {
let thread = cpuWorkthreads.removeFirst()
thread.cancel()
Expand All @@ -169,6 +113,5 @@ class ProfilingViewController: UIViewController, CLLocationManagerDelegate, UITe
let minInterval = (minWorkIntensityTextField.text! as NSString).integerValue
let maxInterval = (maxWorkIntensityTextField.text! as NSString).integerValue
workIntervalMicros = UInt32(_projectedRange(factor: workIntervalSlider.value, min: minInterval, max: maxInterval))
// print("workIntervalMicros: \(workIntervalMicros)")
}
}

0 comments on commit 2543034

Please sign in to comment.