返回列表 发帖

[V6、V7功能解说] 如何为一个程序或子程序激活定时追踪日志

问题汇总:
你想要调查你的代码,甚至是批次任务中的某个性能问题


系统模块:
该解决方案适用于下列版本:Sage X3 V6、V7


解决方法:
你可以用多个功能来激活/取消激活/读取定时追踪日志。

如果你的代码是在批次服务器上或者经由web service执行的话,那么关联背景是很重要的,因为功能是不同的。

——如果你只是想要测试代码,你可以在你的源代码中插入以下语句:

# Activate the timing trace
Call ACTIVE From TIMING

# Your code
...

#Stop and read the timing trace
Call ARRET from TIMING


——如果你的代码需要在批次服务器或者经由web service执行:

# The following statement start the timing trace an log in an intermediate file generated in the runtime tmp directory
# The name of the file is the name of the user used to execute the program
# The second parameter of the function (2) indicates the log of the gosub, replace by 1 if you don't want gosub
Call ACTIVE_MAN(filpath("!tmp",GUSER,"tra","","",""),2) From TIMING

# Your code
...
#Stop the timing trace
#The runtime stop to trace and close the file located in the runtime tmp directory
Call ARRET_MAN From TIMING


如果你想分析生成的文件,则可以使用这种代码:

Call LECTURE(filpath("!tmp",GUSER,"tra","","",""),2) From TIMING

但记得使用相同的用户名(或者输入正确的用户,而不是GUSER)

返回列表