Performance report: fallback for hardware name

The https://apple.stackexchange.com/a/98089 technique does not work on my mac
This commit is contained in:
Gwendal Roué committed 2021-11-07 16:06:50 +01:00
1 parent 0c9de25a8c
commit fe32981e0e
1 file changed
+29 -14
+29 -14
View File
@@ -51,18 +51,33 @@ DERIVED_DATA = tmp
SPM_CHECKOUTS = File.join(DERIVED_DATA, 'SourcePackages', 'checkouts')
# Extract versions
grdb_version = info_plist_version('Support/Info.plist')
fmdb_version = info_plist_version("#{SPM_CHECKOUTS}/fmdb/src/fmdb/Info.plist")
sqlite_swift_version = git_tag_version("#{SPM_CHECKOUTS}/SQLite.swift")
realm_version = git_tag_version("#{SPM_CHECKOUTS}/realm-cocoa")
`xcodebuild -version` =~ /Xcode (.*)$/; xcode_version = $1
`curl -s https://support-sp.apple.com/sp/product?cc=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' | cut -c 9-)` =~ /<configCode>(.*)<\/configCode>/; hardware = $1
STDERR.puts "GRDB #{grdb_version}"
STDERR.puts "FMDB #{fmdb_version}"
STDERR.puts "SQLite.swift #{sqlite_swift_version}"
STDERR.puts "Realm #{realm_version}"
STDERR.puts "Xcode #{xcode_version}"
STDERR.puts "Hardware #{hardware}"
GRDB_VERSION = info_plist_version('Support/Info.plist')
FMDB_VERSION = info_plist_version("#{SPM_CHECKOUTS}/fmdb/src/fmdb/Info.plist")
SQLITE_SWIFT_VERSION = git_tag_version("#{SPM_CHECKOUTS}/SQLite.swift")
REALM_VERSION = git_tag_version("#{SPM_CHECKOUTS}/realm-cocoa")
`xcodebuild -version` =~ /Xcode (.*)$/
XCODE_VERSION = $1
# Hardware name: https://apple.stackexchange.com/a/98089
`curl -s https://support-sp.apple.com/sp/product?cc=$(
system_profiler SPHardwareDataType \
| awk '/Serial/ {print $4}' \
| cut -c 9-)` =~ /<configCode>(.*)<\/configCode>/
hardware = $1
if hardware
HARDWARE = hardware
else
# in case the previous technique does not work
HARDWARE = `system_profiler SPHardwareDataType | awk '/Model Identifier/ {print $3}'`.chomp
end
STDERR.puts "GRDB_VERSION: #{GRDB_VERSION}"
STDERR.puts "FMDB_VERSION: #{FMDB_VERSION}"
STDERR.puts "SQLITE_SWIFT_VERSION: #{SQLITE_SWIFT_VERSION}"
STDERR.puts "REALM_VERSION: #{REALM_VERSION}"
STDERR.puts "XCODE_VERSION: #{XCODE_VERSION}"
STDERR.puts "HARDWARE: #{HARDWARE}"
# Generate
puts <<-REPORT
@@ -70,9 +85,9 @@ puts <<-REPORT
*Last updated #{Date.today.strftime('%B %-d, %Y')}*
Below are performance benchmarks made on for [GRDB #{grdb_version}](https://github.com/groue/GRDB.swift), [FMDB #{fmdb_version}](https://github.com/ccgus/fmdb), and [SQLite.swift #{sqlite_swift_version}](https://github.com/stephencelis/SQLite.swift). They are compared to Core Data, [Realm #{realm_version}](https://realm.io) and the raw use of the SQLite C API from Swift.
Below are performance benchmarks made on for [GRDB #{GRDB_VERSION}](https://github.com/groue/GRDB.swift), [FMDB #{FMDB_VERSION}](https://github.com/ccgus/fmdb), and [SQLite.swift #{SQLITE_SWIFT_VERSION}](https://github.com/stephencelis/SQLite.swift). They are compared to Core Data, [Realm #{REALM_VERSION}](https://realm.io) and the raw use of the SQLite C API from Swift.
This report was generated on a #{hardware}, with Xcode #{xcode_version}, by running the following command:
This report was generated on a #{HARDWARE}, with Xcode #{XCODE_VERSION}, by running the following command:
```sh
make test_performance | Tests/parsePerformanceTests.rb | Tests/generatePerformanceReport.rb