gnomon:命令执行耗时统计

gnomon

gnomon是一个命令行工具,可以标记出另外一个命令执行消耗的时间信息,对一些需要长时间运行的命令特别有效。

安装

先装node.js,然后使用node.js自带的npm安装

npm install -g gnomon

使用

xcodebuild -workspace Live.xcworkspace -scheme Live -archivePath ~/Desktop/Live archive |xcpretty | gnomon
   3.3812s   ▸ Building Pods/Pods-XAIM [Release]
   0.0233s   ▸ Check Dependencies
   0.2392s   ▸ Compiling Pods-XAIM-dummy.m
   0.0404s   ▸ Compiling Pods-XAIM-dummy.m
   0.0121s   ▸ Building library libPods-XAIM.a
   0.0506s   ▸ Building library libPods-XAIM.a
   0.0002s   ▸ Building Pods/Pods-XADataSource [Release]
   0.0024s   ▸ Check Dependencies
   0.0040s   ▸ Compiling Pods-XADataSource-dummy.m
   0.0234s   ▸ Compiling Pods-XADataSource-dummy.m
   0.0104s   ▸ Building library libPods-XADataSource.a
   0.0356s   ▸ Building library libPods-XADataSource.a
   0.0002s   ▸ Building Live/XASDKBundle [Release]
   3.0689s   ▸ Check Dependencies
   2.5132s   ▸ Copying Info.plist
   7.5863s   ▸ Compiling XALiveShopEffectVC.xib
   1.3823s   ▸ Compiling XALiveEditHeadVC.xib
   0.0050s   ▸ Compiling XALiveHomeFooterView.xib
   3.2831s   ▸ Compiling XALiveEffectCvCell.xib
   0.0019s   ▸ Compiling XALiveMessageAlertCell.xib
   0.0006s   ▸ Compiling XALiveSaveHeadVC.xib
   2.8839s   ▸ Compiling XALiveSessionListCell.xib
   2.7045s   ▸ Compiling XALiveRechargeCell.xib
   0.9492s   ▸ Compiling XALiveDynamicCell.xib
   0.0009s   ▸ Compiling XALiveHomeAdCell.xib
   0.0006s   ▸ Compiling XALiveRedMoneyListCell.xib

将编译的结果按时间进行排序,就可以知道哪些文件编译比较耗时。

sort -n -k1 result.txt 

   0.0002s   ▸ Building Live/XASDKBundle [Release]
   0.0002s   ▸ Building Pods/Pods-XADataSource [Release]
   0.0006s   ▸ Compiling XALiveRedMoneyListCell.xib
   0.0006s   ▸ Compiling XALiveSaveHeadVC.xib
   0.0009s   ▸ Compiling XALiveHomeAdCell.xib
   0.0019s   ▸ Compiling XALiveMessageAlertCell.xib
   0.0024s   ▸ Check Dependencies
   0.0040s   ▸ Compiling Pods-XADataSource-dummy.m
   0.0050s   ▸ Compiling XALiveHomeFooterView.xib
   0.0104s   ▸ Building library libPods-XADataSource.a
   0.0121s   ▸ Building library libPods-XAIM.a
   0.0233s   ▸ Check Dependencies
   0.0234s   ▸ Compiling Pods-XADataSource-dummy.m
   0.0356s   ▸ Building library libPods-XADataSource.a
   0.0404s   ▸ Compiling Pods-XAIM-dummy.m
   0.0506s   ▸ Building library libPods-XAIM.a
   0.2392s   ▸ Compiling Pods-XAIM-dummy.m
   0.9492s   ▸ Compiling XALiveDynamicCell.xib
   1.3823s   ▸ Compiling XALiveEditHeadVC.xib
   2.5132s   ▸ Copying Info.plist
   2.7045s   ▸ Compiling XALiveRechargeCell.xib
   2.8839s   ▸ Compiling XALiveSessionListCell.xib
   3.0689s   ▸ Check Dependencies
   3.2831s   ▸ Compiling XALiveEffectCvCell.xib
   3.3812s   ▸ Building Pods/Pods-XAIM [Release]
   7.5863s   ▸ Compiling XALiveShopEffectVC.xib

       // 从大到小排列,输入到文件
       sort -n -r -k 1 result.txt > sort.txt

你可能感兴趣的:(gnomon:命令执行耗时统计)