{"id":5926,"date":"2025-01-07T21:18:32","date_gmt":"2025-01-07T13:18:32","guid":{"rendered":"https:\/\/blog.qdac.cc\/?p=5926"},"modified":"2025-02-26T15:44:49","modified_gmt":"2025-02-26T07:44:49","slug":"%e6%95%99%e7%a8%8bqprofile%e6%95%99%e7%a8%8b%e4%b9%8b%e4%b8%80%ef%bc%9a%e5%9f%ba%e4%ba%8e-delphi-%e7%9a%84%e6%80%a7%e8%83%bd%e5%92%8c%e5%87%bd%e6%95%b0%e8%b7%af%e5%be%84%e5%88%86%e6%9e%90%e5%bc%95","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=5926","title":{"rendered":"[\u6559\u7a0b]QProfile\u6559\u7a0b\u4e4b\u4e00\uff1a\u57fa\u4e8e Delphi \u7684\u6027\u80fd\u548c\u51fd\u6570\u8def\u5f84\u5206\u6790\u5f15\u64ce\u57fa\u7840"},"content":{"rendered":"\n<p><strong>\u3010\u6ce8\u3011QProfile \u4e3a QDAC 4.0 \u5f15\u5165\u7684\u72ec\u7acb\u5355\u5143\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u5728\u9879\u76ee\u4e2d\u76f4\u63a5\u5f15\u7528\u8be5\u5355\u5143\u800c\u4e0d\u4f1a\u5f15\u5165\u5176\u5b83\u95ee\u9898\u3002<\/strong><\/p>\n\n\n\n<p>QProfile \u662f\u4e00\u4e2a\u57fa\u4e8e Delphi \u7684\u4ee3\u7801\u6027\u80fd\u8ddf\u8e2a\u5f15\u64ce\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u627e\u5230\u7a0b\u5e8f\u4e2d\u90a3\u4e00\u90e8\u5206\u4ee3\u7801\u7684\u6267\u884c\u6548\u7387\u3002\u540c\u65f6\uff0c\u5b83\u8fd8\u4f1a\u8bb0\u5f55\u60a8\u7a0b\u5e8f\u4e2d\u51fd\u6570\u8c03\u7528\u987a\u5e8f\u3001\u8c03\u7528\u53ca\u9012\u5f52\u6b21\u6570\u3001\u4f9d\u8d56\u5173\u7cfb\u7b49\u4fe1\u606f\uff0c\u4ece\u800c\u751f\u6210\u51fd\u6570\u8c03\u7528\u8def\u5f84\u5206\u6790\u62a5\u544a\u3002<\/p>\n\n\n\n<p>\u5f53\u7136\uff0c\u505a\u4e3a\u5b9e\u73b0\u4e0a\u8ff0\u529f\u80fd\uff0cQProfile \u5e76\u975e\u6beb\u65e0\u4ee3\u4ef7\uff0c\u4f46\u5b83\u7684\u5f00\u9500\u5f88\u5c0f\uff0c\u60a8\u51e0\u4e4e\u53ef\u4ee5\u653e\u5fc3\u7684\u5728\u6b63\u5f0f\u8fd0\u884c\u7684\u4ee3\u7801\u4e2d\u542f\u7528\u672c\u529f\u80fd\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5360\u7528\u5185\u5b58\u6781\u5c0f\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u624d\u4f1a\u5360\u7528\u4e00\u4e2a IQProfileHelper \u63a5\u53e3\u5b9e\u73b0\uff0cTQProfile.Calc \u4f1a\u4e3a\u6bcf\u4e2a\u5e8f\u5217\u91cd\u590d\u8bbf\u95ee\u5171\u4eab\u7b2c\u4e00\u6b21\u521b\u5efa\u7684\u5b9e\u4f8b\u3002<\/li>\n\n\n\n<li>\u540c\u4e00\u8c03\u7528\u5e8f\u5217\uff0c\u4ec5\u5728\u7b2c\u4e00\u6b21\u8bbf\u95ee\u65f6\uff0c\u624d\u4f1a\u5206\u914d\u5185\u5b58\uff0c\u540e\u7eed\u8bbf\u95ee\u90fd\u662f\u76f4\u63a5\u91cd\u7528\uff0c\u800c\u4e0d\u4f1a\u91cd\u65b0\u5206\u914d\uff0c\u7701\u5374\u91cd\u590d\u5206\u914d\u5185\u5b58\u65f6\u95f4\u3002<\/li>\n\n\n\n<li>\u5c3d\u53ef\u80fd\u7b80\u5316\u5904\u7406\u903b\u8f91\uff0c\u964d\u4f4e\u51fd\u6570\u8ddf\u8e2a\u5206\u6790\u9700\u8981\u7684\u4ee3\u7801\u91cf\u3002<\/li>\n\n\n\n<li>\u5728\u9700\u8981\u5b8c\u6574\u6027\u80fd\u65f6\uff0c\u7a0b\u5e8f\u4e2d\u53ef\u4ee5\u901a\u8fc7\u4ee3\u7801\u6765\u968f\u65f6\u7981\u7528\u8ddf\u8e2a\u8bb0\u5f55\u529f\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ea7\u54c1\u7528\u9014<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u57fa\u4e8e\u51fd\u6570\u7684\u8c03\u7528\u6b21\u6570\u3001\u6267\u884c\u65f6\u95f4\u3001\u8c03\u7528\u5e8f\u5217\u7b49\u4fe1\u606f\uff0c\u5206\u6790\u4ee3\u7801\u6027\u80fd\u74f6\u5f84\uff0c\u627e\u5230\u6162\u4ee3\u7801\uff0c\u4ece\u800c\u8fdb\u884c\u9488\u5bf9\u6027\u4f18\u5316\uff0c\u4ece\u800c\u63d0\u5347\u4ea7\u54c1\u8fd0\u884c\u6548\u7387\u3002<\/li>\n\n\n\n<li>\u901a\u8fc7\u5206\u6790\u51fd\u6570\u95f4\u8c03\u7528\u5173\u7cfb\uff0c\u4e0e\u4e1a\u52a1\u6d41\u7a0b\u8fdb\u884c\u6bd4\u5bf9\uff0c\u4ece\u800c\u627e\u51fa\u95ee\u9898\u4ee3\u7801\u3002<\/li>\n\n\n\n<li>\u901a\u8fc7\u6267\u884c\u51fd\u6570\u8def\u5f84\u5206\u6790\uff0c\u8f85\u52a9\u5f00\u53d1\u4eba\u5458\u5bf9\u51fd\u6570\u4e2d\u65e0\u6548\u7684\u8def\u5f84\u8fdb\u884c\u5254\u9664\uff0c\u63d0\u5347\u4ee3\u7801\u8d28\u91cf\u3002<\/li>\n\n\n\n<li>\u5e76\u53d1\u51b2\u7a81\u5206\u6790\uff0c\u8f85\u52a9\u5f00\u53d1\u4eba\u5458\u5728\u591a\u7ebf\u7a0b\u5f00\u53d1\u4e2d\uff0c\u627e\u5230\u5e76\u53d1\u51fd\u6570\uff0c\u4ee5\u4fbf\u8fdb\u884c\u5fc5\u8981\u7684\u52a0\u9501\u5904\u7406\uff0c\u907f\u514d\u5e76\u53d1\u51b2\u7a81\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u5df2\u77e5\u95ee\u9898<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TQProfile \u6ca1\u6709\u7f16\u5199 IDE \u63d2\u4ef6\u6765\u96c6\u6210\u5230 IDE\uff0c\u6682\u65f6\u4e0d\u652f\u6301\u81ea\u52a8\u5316\u4e3a\u60a8\u7684\u4ee3\u7801\u6dfb\u52a0 TQProfile.Calc(\u51fd\u6570\u540d) \u7684\u4ee3\u7801\uff0c\u9700\u8981\u60a8\u81ea\u884c\u5728\u9700\u8981\u6d4b\u8bd5\u6027\u80fd\u7684\u5730\u65b9\u8c03\u7528 TQProfile.Calc \u51fd\u6570\u3002<\/li>\n\n\n\n<li>TQProfile \u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u7ef4\u62a4\u8ddf\u8e2a\u4fe1\u606f\uff0c\u4e0d\u540c\u7ebf\u7a0b\u7684\u8ddf\u8e2a\u4fe1\u606f\u5e76\u4e0d\u4f1a\u81ea\u52a8\u5408\u5e76\uff08\u5f53\u7136\uff0c\u60a8\u53ef\u4ee5\u5bf9\u5176\u8fdb\u884c\u540e\u671f\u5904\u7406\uff09\u3002<\/li>\n\n\n\n<li>TQProfile \u4e0d\u4f1a\u56e0\u4e3a\u7ebf\u7a0b\u88ab\u91ca\u653e\uff0c\u800c\u81ea\u52a8\u91ca\u653e\u8be5\u7ebf\u7a0b\u5bf9\u5e94\u7684\u8ddf\u8e2a\u8bb0\u5f55\uff0c\u6362\u53e5\u8bdd\u8bf4\uff0c\u5982\u679c\u60a8\u7684\u7a0b\u5e8f\u5728\u4e0d\u65ad\u7684\u521b\u5efa\/\u91ca\u653e\u7ebf\u7a0b\uff0c\u800c\u5728\u5bf9\u5e94\u7684\u7ebf\u7a0b\u4e2d\u5b58\u5728\u8ddf\u8e2a\u4ee3\u7801\uff0c\u5219\u4f1a\u968f\u7740\u6bcf\u6b21\u7ebf\u7a0b\u7684\u521b\u5efa\u548c\u91ca\u653e\uff0c\u751f\u6210\u4e00\u4efd\u9664\u4e86\u7ebf\u7a0bID\u4e0d\u4e00\u6837\uff0c\u5176\u5b83\u5185\u5bb9\u91cd\u590d\u7684\u62f7\u8d1d\u3002<\/li>\n\n\n\n<li>TQProfile \u5728\u542f\u7528\u72b6\u6001\u4e0b\uff0c\u4f1a\u81ea\u52a8\u5728\u7a0b\u5e8f\u9000\u51fa\u65f6\u4fdd\u5b58\u8ddf\u8e2a\u6570\u636e\u5230 TQProfile.FileName \u5c5e\u6027\u6307\u5b9a\u7684 json \u683c\u5f0f\u6587\u4ef6\u4e2d\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u57fa\u7840\u7528\u6cd5<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5728\u60a8\u9879\u76ee\u7684\u641c\u7d22\u8def\u5f84\u8def\u5f84\u4e2d\u52a0\u5165 qdac.profile.pas \u5355\u5143\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n\n\n\n<li>\u5728\u60a8\u7684\u4ee3\u7801\u7684 uses \u6307\u4ee4\u4e2d\uff0c\u52a0\u5165 qdac.profile \u3002<\/li>\n\n\n\n<li>\u4e3a\u60a8\u9700\u8981\u8ddf\u8e2a\u7684\u51fd\u6570\u7684\u5f00\u59cb\u8ba1\u65f6\u4f4d\u7f6e\uff0c\u6dfb\u52a0 TQProfile.Calc \u8c03\u7528\u4ee3\u7801\u3002<\/li>\n\n\n\n<li>\u786e\u8ba4 TQProfile.Enabled \u4e3a true \u4ee5\u542f\u7528\u8ddf\u8e2a\uff1a\n<ul class=\"wp-block-list\">\n<li>\u8c03\u8bd5\u6a21\u5f0f\uff0c\u9ed8\u8ba4\u8be5\u503c\u4e3a true<\/li>\n\n\n\n<li>\u547d\u4ee4\u884c\u53c2\u6570\u52a0\u5165 \/EnableProfile \u53ef\u4ee5\u5f3a\u5236\u8bbe\u7f6e\u8be5\u503c\u4e3a true<\/li>\n\n\n\n<li>\u7528\u6237\u81ea\u5df1\u901a\u8fc7\u8bbe\u7f6e TQProfile.Enabled := true \u6765\u542f\u7528\u8ddf\u8e2a\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u7f16\u8bd1\u8fd0\u884c\u7a0b\u5e8f\uff0c\u5e76\u6267\u884c\u5fc5\u8981\u7684\u64cd\u4f5c\u3002<\/li>\n\n\n\n<li>\u9000\u51fa\u7a0b\u5e8f<\/li>\n\n\n\n<li>\u67e5\u770b\u6027\u80fd\u548c\u8ddf\u8e2a\u5206\u6790\u8bb0\u5f55\u6587\u4ef6\uff08\u9ed8\u8ba4\u4e3a\u7a0b\u5e8f\u6267\u884c\u76ee\u5f55\u4e0b\u7684 profiles.json\uff09<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u57fa\u7840\u793a\u4f8b<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nimplementation\n\nuses qdac.profile;\n\/\/\u4ee5\u4e0a\u4e24\u884c\uff0c\u540e\u7eed\u793a\u4f8b\u7701\u7565\n\nprocedure test();\n   procedure f1();\n   begin\n     TQProfile.Calc('test.f1');\n     ...\n   end;\nbegin\n  TQProfile.Calc('f1');\n  f1();\nend;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u8f93\u51fa\u7ed3\u679c<\/h2>\n\n\n\n<p>\u4e0b\u9762\u7684\u7ed3\u679c\u662f\u81ea\u5e26\u7684\u793a\u4f8b\u7a0b\u5e8f\u7684\u8f93\u51fa\u7ed3\u679c\uff0c\u5177\u4f53\u683c\u5f0f\u89e3\u6790\uff0c\u6211\u4eec\u5728\u540e\u9762\u8fdb\u884c\u8be6\u7ec6\u8bf4\u660e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n  {\n    \"threadId\":8740,\n    \"freq\":10000000,\n    \"mainThread\":true,\n    \"chains\":&#91;\n      {\n        \"name\":\"TForm1.Button1Click\",\n        \"maxNestLevel\":0,\n        \"runs\":1,\n        \"minTime\":0,\n        \"maxTime\":782,\n        \"totalTime\":782,\n        \"avgTime\":782,\n        \"children\":&#91;\n          {\n            \"name\":\"TForm1.DoProfile\",\n            \"maxNestLevel\":32,\n            \"runs\":1,\n            \"minTime\":0,\n            \"maxTime\":578,\n            \"totalTime\":578,\n            \"avgTime\":578\n          }\n        ]\n      },\n      {\n        \"name\":\"TForm1.Button1Click.ForceQueue#1\",\n        \"maxNestLevel\":0,\n        \"runs\":1,\n        \"minTime\":0,\n        \"maxTime\":19876018,\n        \"totalTime\":19876018,\n        \"avgTime\":19876018,\n        \"refs\":&#91;\n          \"TForm1.Button1Click\"\n        ]\n      },\n      {\n        \"name\":\"TForm1.Button3Click\",\n        \"maxNestLevel\":0,\n        \"runs\":1,\n        \"minTime\":0,\n        \"maxTime\":856,\n        \"totalTime\":856,\n        \"avgTime\":856\n      }\n    ]\n  },\n  {\n    \"threadId\":7648,\n    \"chains\":&#91;\n      {\n        \"name\":\"TForm1.DoProfile\",\n        \"maxNestLevel\":32,\n        \"runs\":1,\n        \"minTime\":0,\n        \"maxTime\":590,\n        \"totalTime\":590,\n        \"avgTime\":590\n      }\n    ]\n  }\n]<\/code><\/pre>\n\n\n\n<p><strong>\u3010\u66f4\u65b0\u3011<\/strong><\/p>\n\n\n\n<p>TQProfile.Calc \u51fd\u6570\u589e\u52a0\u4e86\u4e00\u4e2a\u91cd\u8f7d\uff0c\u8fd9\u4e2a\u91cd\u8f7d\u4e0d\u518d\u8981\u6c42\u7528\u6237\u4f20\u5165\u5f53\u524d\u8bb0\u5f55\u70b9\uff0c\u800c\u662f\u81ea\u52a8\u53d6\u5f53\u524d\u8bb0\u5f55\u70b9\u7684\u5730\u5740\uff0c\u7136\u540e\u901a\u8fc7\u5c06\u5730\u5740\u8f6c\u6362\u4e3a\u7b26\u53f7\u8868\u6765\u89e3\u51b3\u5730\u5740\u5230\u540d\u79f0\u7684\u6620\u5c04\u5173\u7cfb\uff0c\u751f\u6210\u7c7b\u578b Unit1.TForm1.Button1Click+L202 \u8fd9\u79cd\u5f62\u5f0f\u7684\u540d\u79f0\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>procedure TForm1.Button7Click(Sender: TObject);\nbegin\n  TQProfile.Calc();\n  ShowMessage('Simple calc');\nend;<\/code><\/pre>\n\n\n\n<p>\u751f\u6210\u7ed3\u679c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n\"mainThreadId\":4244,\n\"freq\":10000000,\n\"threads\":&#91;\n  {\n    \"threadId\":4244,\n    \"startTime\":34285723,\n    \"latestTime\":58869411,\n    \"chains\":&#91;\n      {\n        \"name\":\"Unit1.TForm1.Button7Click+L116\",\n        \"maxNestLevel\":0,\n        \"runs\":1,\n        \"minTime\":0,\n        \"maxTime\":24583645,\n        \"totalTime\":24583645,\n        \"avgTime\":24583645\n      }\n    ]\n  }\n  ]\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u6ce8\u3011QProfile \u4e3a QDAC 4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8,9,834],"tags":[450,584,835],"class_list":["post-5926","post","type-post","status-publish","format-standard","hentry","category-delphi","category-qdac","category-qprofile","tag-delphi","tag-584","tag-835"],"views":1271,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5926"}],"version-history":[{"count":6,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5926\/revisions"}],"predecessor-version":[{"id":5988,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/5926\/revisions\/5988"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}