当前位置: 首页 > news >正文

大连装修公司排名前十口碑推荐网站seo优化工具

大连装修公司排名前十口碑推荐,网站seo优化工具,如何制作表白链接,wordpress加载速度太慢二进制重排作用 二进制重排的主要目的是将连续调用的函数连接到相邻的虚拟内存地址#xff0c;这样在启动时可以减少缺页中断的发生#xff0c;提升启动速度。目前网络上关于ios应用启动优化#xff0c;通过XCode实现的版本比较多。MacOS上的应用也是通过clang进行编译的这样在启动时可以减少缺页中断的发生提升启动速度。目前网络上关于ios应用启动优化通过XCode实现的版本比较多。MacOS上的应用也是通过clang进行编译的理论上也可以进行二进制重排主要分为两步。   首先是获取启动过程调用的函数符号需要通过clang插桩方式实现对于其它编译器目前没有找到类似的功能。 编译选项 set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fsanitize-coveragefunc,trace-pc-guard)set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fsanitize-coveragefunc,trace-pc-guard)入口函数 然后是入口函数实现收集调用函数符号序列通过下面的代码可以实现生成。 #ifndef APPCALLCOLLECTOR_H_ #define APPCALLCOLLECTOR_H_#import Foundation/Foundation.h//! Project version number for AppCallCollecter. FOUNDATION_EXPORT double AppCallCollecterVersionNumber;//! Project version string for AppCallCollecter. FOUNDATION_EXPORT const unsigned char AppCallCollecterVersionString[];/// 与CLRAppOrderFile只能二者用其一 extern NSArray NSString * *getAppCalls(void);/// 与getAppCalls只能二者用其一 extern void appOrderFile(NSString* orderFilePath);// In this header, you should import all the public headers of your framework using statements like #import AppCallCollecter/PublicHeader.h #endif#import appcallcollector.h #import dlfcn.h #import libkern/OSAtomicQueue.h #import pthread.hstatic OSQueueHead qHead OS_ATOMIC_QUEUE_INIT; static BOOL stopCollecting NO;typedef struct {void *pointer;void *next; } PointerNode;// dyld链接dylib时调用start和stop地址之间的保存该dylib的所有符号的个数 // 可以不实现具体内容不影响后续调用 extern C void __sanitizer_cov_trace_pc_guard_init(uint32_t *start,uint32_t *stop) {static uint32_t N; // Counter for the guards.if (start stop || *start) return; // Initialize only once.printf(INIT: %p %p\n, start, stop);for (uint32_t *x start; x stop; x)*x N; // Guards should start from 1.printf(totasl count %i\n, N); }// This callback is inserted by the compiler on every edge in the // control flow (some optimizations apply). // Typically, the compiler will emit the code like this: // if(*guard) // __sanitizer_cov_trace_pc_guard(guard); // But for large functions it will emit a simple call: // __sanitizer_cov_trace_pc_guard(guard); /* 通过汇编可发现每个函数调用前都被插入了bl 0x102b188c0 ; symbol stub for: __sanitizer_cov_trace_pc_guard所以在每个函数调用时都会先跳转执行该函数 */ extern C void __sanitizer_cov_trace_pc_guard(uint32_t *guard) {// If initialization has not occurred yet (meaning that guard is uninitialized), that means that initial functions like load are being run. These functions will only be run once anyways, so we should always allow them to be recorded and ignore guard// load方法先于guard_init调用此时guard为0if(!*guard) { return; }if (stopCollecting) {return;}// __builtin_return_address 获取当前调用栈信息取第一帧地址即下条要执行的指令地址被插桩的函数地址void *PC __builtin_return_address(0);PointerNode *node (PointerNode *)malloc(sizeof(PointerNode));*node (PointerNode){PC, NULL};// 使用原子队列要存储帧地址OSAtomicEnqueue(qHead, node, offsetof(PointerNode, next)); }extern NSArray NSString * *getAllFunctions(NSString *currentFuncName) {NSMutableSetNSString * *unqSet [NSMutableSet setWithObject:currentFuncName];NSMutableArray NSString * *functions [NSMutableArray array];while (YES) {PointerNode *front (PointerNode *)OSAtomicDequeue(qHead, offsetof(PointerNode, next));if(front NULL) {break;}Dl_info info {0};// dladdr获取地址符号信息dladdr(front-pointer, info);NSString *name (info.dli_sname);// 去除重复调用if([unqSet containsObject:name]) {continue;}BOOL isObjc [name hasPrefix:[] || [name hasPrefix:-[];// order文件格式要求C函数和block前需要添加_NSString *symbolName isObjc ? name : [_ stringByAppendingString:name];[unqSet addObject:name];[functions addObject:symbolName];}// 取反得到正确调用排序return [[functions reverseObjectEnumerator] allObjects];; }#pragma mark - publicextern NSArray NSString * *getAppCalls(void) {stopCollecting YES;// 内存屏障防止cpu的乱序执行调度内存原子锁__sync_synchronize();NSString* curFuncationName [NSString stringWithUTF8String:__FUNCTION__];return getAllFunctions(curFuncationName); }extern void appOrderFile(NSString* orderFilePath) {stopCollecting YES;__sync_synchronize();NSString* curFuncationName [NSString stringWithUTF8String:__FUNCTION__];NSArray *functions getAllFunctions(curFuncationName);NSString *orderFileContent [functions.reverseObjectEnumerator.allObjects componentsJoinedByString:\n];NSLog([orderFile]: %,orderFileContent);NSString *filePath [NSTemporaryDirectory() stringByAppendingPathComponent:orderFile.order];NSData * fileContents [orderFileContent dataUsingEncoding:NSUTF8StringEncoding];// NSArray *functions getAllFunctions(curFuncationName);// NSString * funcString [symbolAry componentsJoinedByString:\n];// NSString * filePath [NSTemporaryDirectory() stringByAppendingPathComponent:lb.order];// NSData * fileContents [funcString dataUsingEncoding:NSUTF8StringEncoding];BOOL result [[NSFileManager defaultManager] createFileAtPath:filePath contents:fileContents attributes:nil];if (result) {NSLog(%,filePath);}else{NSLog(文件写入出错);} }链接器配置 拿到函数符号列表后需要通过链接选项将列表文件传递给链接器也可以通过链接选项输出link map查看重排前后的符号顺序。 -order_file_statistics   Logs information about the processing of a -order_file. -map map_file_path   Writes a map file to the specified path which details all symbols and their addresses in the output image. -order_file file   Alters the order in which functions and data are laid out. For each section in the outputfile, any symbol in that section that are specified in the order file file is moved to the start of its section and laid out in the same order as in the order file file. Order files are text files with one symbol name per line. Lines starting with a # are comments. A symbol name may be optionally preceded with its object file leaf name and a colon (e.g. foo.o:_foo). This is useful for static functions/data that occur in multiple files. A symbol name may also be optionally preceded with the architecture (e.g. ppc:_foo or ppc:foo.o:_foo). This enables you to have one order file that works for multiple architec-tures. Literal c-strings may be ordered by by quoting the string (e.g. “Hello, world\n”) in the order file. 可执行程序模块重排 set(CMAKE_CXX_LINK_FLAGS -Xlinker -map -Xlinker /Users/Desktop/out/out001.txt -Xlinker -order_file_statistics -Xlinker -order_file -Xlinker /Users/Desktop/out/orderFile_cpp.order ${CMAKE_CXX_LINK_FLAGS})动态库重排 set(CMAKE_SHARED_LINKER_FLAGS -Xlinker -map -Xlinker /Users/Desktop/out/out002.txt -Xlinker -order_file_statistics -Xlinker -order_file -Xlinker /Users/Desktop/out/orderFile_add.order ${CMAKE_SHARED_LINKER_FLAGS})
http://www.zqtcl.cn/news/786181/

相关文章:

  • 360网站建设的目标是什么微信哪个公司开发
  • c++可以做网站吗极验 wordpress 表单
  • 电脑做系统都是英文选哪个网站找外贸客户的联系方式软件
  • 商城网站建设咨询建工社官网
  • 国土资源局网站建设制度蓝牙 技术支持 东莞网站建设
  • 12380网站建设建议上海网站推广服务
  • 做公司网站要提供什么企业门户app
  • 免费企业网站模板 php网站301跳转怎么做
  • 沭阳哪里有做网站推广的二手车网站源码下载
  • 网站建设添加视频教程wordpress做阿里巴巴国际站
  • 四川网站建设哪家专业辽宁招投标工程信息网
  • 小语种网站建设wordpress 上传图片不显示
  • 建网站什么网最好重庆制作网站公司简介
  • 中国建站平台邯郸现代建设集团网站
  • 爱站seo排名可以做哪些网站宁波网站怎么建设
  • 洛阳市伊滨区建设局网站企业集团网站源码
  • 做修图网站电脑配置wordpress后台登录页面美化
  • 中国十大物联网公司广州网站快速排名优化
  • 发帖网站有哪些wordpress提请审批
  • 网页设计网站导航怎么弄红色字体的内蒙古住房与建设厅网站
  • 微信网站什么做百度官网认证
  • 怎么提升网站流量做五金建材市场的网站
  • 网站合作流程h5网站怎么做api对接
  • asp.net 网站 结构手机客户端网站建设
  • 图片网站怎么做SEO参与网站建设注意
  • 网站界面设计案例教程wordpress更新报错
  • Dw做网站怎么加logo如何申请小程序店铺
  • 官方网站下载官方版本wordpress文字可以动的插件
  • 企业网站模板 免费下载网站建设服务采购方案模板下载
  • 在万网申请的域名_需要把万网的账户密码给做网站的吗做鱫视频网站