Skip to content

Commit f28cfd7

Browse files
committed
Try to get the iphone version
1 parent 93e466f commit f28cfd7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

extension/apple/Benchmark/Tests/Tests.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import <XCTest/XCTest.h>
1010

1111
#import <objc/runtime.h>
12+
#import <sys/utsname.h>
1213
#import <UIKit/UIDevice.h>
1314

1415
#import <executorch/extension/module/module.h>
@@ -27,7 +28,12 @@ @implementation DeviceInfo
2728

2829
+(NSString *)getDeviceInfo {
2930
NSString *device = [[UIDevice currentDevice] model];
30-
NSString *name = [[UIDevice currentDevice] name];
31+
32+
// i.e. iPhone15
33+
struct utsname systemInfo;
34+
uname(&systemInfo);
35+
NSString *name = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
36+
3137
NSString *systemName = [[UIDevice currentDevice] systemName];
3238
NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
3339
return [NSString stringWithFormat:@"%@_%@_%@_%@", device, name, systemName, systemVersion];
@@ -90,7 +96,7 @@ + (void)initialize {
9096
[self class], testLoadSelector, testLoadImplementation, "v@:");
9197

9298
SEL testForwardSelector = NSSelectorFromString([NSString
93-
stringWithFormat:@"test_forward_%@_%@", directoryName, modelName]);
99+
stringWithFormat:@"test_forward_%@_%@_%@", directoryName, modelName, deviceInfo]);
94100
IMP testForwardImplementation = imp_implementationWithBlock(^(
95101
id _self) {
96102
auto __block module = std::make_unique<Module>(modelPath.UTF8String);

0 commit comments

Comments
 (0)