按照下面的步骤使用profile函数。
(1)在命令窗口中键入profile,指定任何想使用的选项。
(2)运行M文件,profile函数计算M文件的每一行使用多少时间,它是累加运行的。
表3-1是一个Profile主窗口的综述表。键入doc profile,可以查看这些选项以及其他选项的细节。
表3-1 Profile主窗口的综述表
| 语 法 | 选 项 | 描 述 |
|---|---|---|
| profile on | 启动Profile,清除前面记录的统计 | |
| profile on | -detaillevel | 指定要Profile的函数的等级 |
| profile on | -history | 指定函数调用的确切次序 |
| profile off | 取消Profile | |
| profile resume | 在不清除前面记录的情况下重新启动Profile | |
| profile clear | 清除探查记录的统计信息 | |
| profile viewer | 打开探查器的图形用户界面。这将提供用Profile函数集中的信息,但格式与Profile函数报表的不同 | |
| s=profile(‘status’) | 显示一个包含当前探查状态的结构 | |
| stats=profile(‘info’) | 延缓探查并显示一个包含探查结果的结构 |