Skip to content

Instantly share code, notes, and snippets.

@KentarouKanno
Last active August 16, 2016 09:42
Show Gist options
  • Save KentarouKanno/5d53281bdd0e736dff92f0e807822913 to your computer and use it in GitHub Desktop.
Save KentarouKanno/5d53281bdd0e736dff92f0e807822913 to your computer and use it in GitHub Desktop.
NSProcessInfo

NSProcessInfo

参考URL: NSProcessInfo

★ Unique ID

let uniqueId = NSProcessInfo.processInfo().globallyUniqueString
//=> 9F27E385-6759-4717-9BE2-1EEEB496A5C3-45405-00001FA0DB82ABD6
let processInfo = NSProcessInfo.processInfo()

print("arguments = ",processInfo.arguments)
//=> arguments =  ["/Users/KentarOu/Library/Developer/CoreSimulator/Devices/6439161B-9F69-454B-B68A-398EA33AD1ED/data/Containers/Bundle/Application/B47F83D8-41AA-44F4-AB97-C3DCA9B38877/BackgroundFetch.app/BackgroundFetch"]

print("hostName = ",processInfo.hostName)
//=> hostName =  kentarou.local

print("processName = ",processInfo.processName)
//=> processName =  BackgroundFetch

print("processIdentifier = ",processInfo.processIdentifier)
//=> processIdentifier =  50202

print("globallyUniqueString = ",processInfo.globallyUniqueString)
//=> globallyUniqueString =  F4682E01-CAC9-44BC-BE6E-76364A8F8032-50202-000022F669729E3C

print("operatingSystemVersionString = ",processInfo.operatingSystemVersionString)
//=> operatingSystemVersionString =  Version 9.3 (Build 13E230)

print("processorCount = ",processInfo.processorCount)
//=> processorCount =  4

print("activeProcessorCount = ",processInfo.activeProcessorCount)
//=> activeProcessorCount =  4

print("physicalMemory = ",processInfo.physicalMemory)
//=> physicalMemory =  25769803776

print("systemUptime = ",processInfo.systemUptime)
//=> systemUptime =  38441.727946541

print("environment = ",processInfo.environment)
//=> environment =  ["SIMULATOR_MAINSCREEN_WIDTH": "750", "__XPC_DYLD_LIBRARY_PATH": ..........
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment