Skip to content

Commit

Permalink
Merge 9546e20 into 5025d2e
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrenskers authored Sep 22, 2022
2 parents 5025d2e + 9546e20 commit 1e02273
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
4 changes: 4 additions & 0 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
0A9BF4E428A114B50068D266 /* SentryViewHierarchyIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A9BF4E328A114B50068D266 /* SentryViewHierarchyIntegration.h */; };
0A9BF4E928A125390068D266 /* TestSentryViewHierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9BF4E628A123270068D266 /* TestSentryViewHierarchy.swift */; };
0A9BF4EB28A127120068D266 /* SentryViewHierarchyIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9BF4EA28A127120068D266 /* SentryViewHierarchyIntegrationTests.swift */; };
0A9E917128DC7E7000FB4182 /* SentryInternalDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A9E917028DC7E7000FB4182 /* SentryInternalDefines.h */; };
0AABE2ED2885924A0057ED69 /* SentryPermissionsObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AABE2EC2885924A0057ED69 /* SentryPermissionsObserver.m */; };
0ACBA10128A6406400D711F7 /* UIView+Sentry.m in Sources */ = {isa = PBXBuildFile; fileRef = 0ACBA10028A6406400D711F7 /* UIView+Sentry.m */; };
0ACBA10328A6407200D711F7 /* UIView+Sentry.h in Headers */ = {isa = PBXBuildFile; fileRef = 0ACBA10228A6407200D711F7 /* UIView+Sentry.h */; };
Expand Down Expand Up @@ -757,6 +758,7 @@
0A9BF4E328A114B50068D266 /* SentryViewHierarchyIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryViewHierarchyIntegration.h; path = include/SentryViewHierarchyIntegration.h; sourceTree = "<group>"; };
0A9BF4E628A123270068D266 /* TestSentryViewHierarchy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryViewHierarchy.swift; sourceTree = "<group>"; };
0A9BF4EA28A127120068D266 /* SentryViewHierarchyIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryViewHierarchyIntegrationTests.swift; sourceTree = "<group>"; };
0A9E917028DC7E7000FB4182 /* SentryInternalDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryInternalDefines.h; path = include/SentryInternalDefines.h; sourceTree = "<group>"; };
0AABE2EC2885924A0057ED69 /* SentryPermissionsObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryPermissionsObserver.m; sourceTree = "<group>"; };
0AABE2EE288592750057ED69 /* SentryPermissionsObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryPermissionsObserver.h; path = include/SentryPermissionsObserver.h; sourceTree = "<group>"; };
0AABE2EF2885C2120057ED69 /* TestSentryPermissionsObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryPermissionsObserver.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1808,6 +1810,7 @@
7B2A70DC27D6083D008B0D15 /* SentryThreadWrapper.m */,
7B18DE3F28D9F748004845C6 /* SentryNSNotificationCenterWrapper.h */,
7B18DE4128D9F794004845C6 /* SentryNSNotificationCenterWrapper.m */,
0A9E917028DC7E7000FB4182 /* SentryInternalDefines.h */,
);
name = Helper;
sourceTree = "<group>";
Expand Down Expand Up @@ -2957,6 +2960,7 @@
D8479328278873A100BE8E99 /* SentryByteCountFormatter.h in Headers */,
63AA76981EB9C1C200D153DE /* SentryClient.h in Headers */,
63AA76971EB9C1C200D153DE /* Sentry.h in Headers */,
0A9E917128DC7E7000FB4182 /* SentryInternalDefines.h in Headers */,
63FE711F20DA4C1000CDBAE8 /* SentryCrashObjC.h in Headers */,
7BC3936825B1AB3E004F03D3 /* SentryLevelMapper.h in Headers */,
8E4E7C6E25DAAAFE006AB9E2 /* SentrySpan.h in Headers */,
Expand Down
6 changes: 3 additions & 3 deletions Sources/Sentry/SentryCrashWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ - (NSDictionary *)systemInfo
return sharedInfo;
}

- (uint64_t)freeMemory
- (bytes)freeMemory
{
return sentrycrashcm_system_freememory();
}

- (uint64_t)freeStorage
- (bytes)freeStorage
{
return sentrycrashcm_system_freestorage();
}

- (uint64_t)appMemory
- (bytes)appMemory
{
task_vm_info_data_t info;
mach_msg_type_number_t size = TASK_VM_INFO_COUNT;
Expand Down
9 changes: 6 additions & 3 deletions Sources/Sentry/include/SentryCrashWrapper.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#import "SentryDefines.h"
#import "SentryInternalDefines.h"
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef uint64_t bytes;

/** A wrapper around SentryCrash for testability.
*/
@interface SentryCrashWrapper : NSObject
Expand Down Expand Up @@ -30,11 +33,11 @@ SENTRY_NO_INIT

- (NSDictionary *)systemInfo;

- (uint64_t)freeMemory;
- (bytes)freeMemory;

- (uint64_t)appMemory;
- (bytes)appMemory;

- (uint64_t)freeStorage;
- (bytes)freeStorage;

@end

Expand Down
1 change: 1 addition & 0 deletions Sources/Sentry/include/SentryInternalDefines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef unsigned long long bytes;
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ extern "C" {
#endif

#include "SentryCrashMonitor.h"
#import "SentryInternalDefines.h"

/** Access the Monitor API.
*/
SentryCrashMonitorAPI *sentrycrashcm_system_getAPI(void);

bool sentrycrash_isSimulatorBuild(void);

uint64_t sentrycrashcm_system_freememory(void);
uint64_t sentrycrashcm_system_freestorage(void);
bytes sentrycrashcm_system_freememory(void);
bytes sentrycrashcm_system_freestorage(void);

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
return true;
}

static uint64_t
static bytes
freeMemory(void)
{
vm_statistics_data_t vmStats;
Expand All @@ -199,13 +199,13 @@
return 0;
}

uint64_t
bytes
sentrycrashcm_system_freememory(void)
{
return freeMemory();
}

static uint64_t
static bytes
usableMemory(void)
{
vm_statistics_data_t vmStats;
Expand Down Expand Up @@ -486,7 +486,7 @@
return "unknown";
}

static uint64_t
static bytes
getTotalStorageSize()
{
NSNumber *storageSize = [[[NSFileManager defaultManager]
Expand All @@ -495,7 +495,7 @@
return storageSize.unsignedLongLongValue;
}

static uint64_t
static bytes
getFreeStorageSize()
{
NSNumber *storageSize = [[[NSFileManager defaultManager]
Expand Down

0 comments on commit 1e02273

Please sign in to comment.