【erlang 学习】 tsung 源代码分析 怎么debug tsung

 本人是大三,初学erlang,是个菜鸟。若觉得这篇文章没有水平,那么sorry,浪费你时间了。我仅是做个笔记而已。

  环境:

  系统:ubuntu 10.10

  erlang版本: R15B

  tsung版本:1.4.2

  emacs


准备工作:

 (一)让emacs的flymake 插件别再报错。

由于tsung的源代码分级比普通的项目多一级,所以flymake读不到hrl的include文件夹

修改flymake的脚本,

#!/usr/bin/env escript
-export([main/1]).
main([File_Name]) ->
    compile:file(File_Name, [warn_obsolete_guard, warn_unused_import,
                             warn_shadow_vars, warn_export_vars,
                             strong_validation, report,
                             {i, "../../include"}]).
~                                                    

(二) emacs支持tsung的debug编译信息

tsung的makefile上有一个选项,是make debug,就会编译tsung with debug_info。

但是emacs debug时候无法interpreting 。

解决办法:

在erlang 配置文件让tsung编译后的文件加入path

$vim ~/.erlang

加入

CurPath = element(2, file:get_cwd()).
AddPath = CurPath++"/"++"../../ebin".
code:add_patha(AddPath).




(三)env的加入

tsung的tsung.sh上可以看出。tsung的启动流程和参数。

我改了一下,把启动信息全部输出,得出如下:

/opt/erl/bin/erl -kernel inet_dist_listen_min 64000 -kernel inet_dist_listen_max 65500 -smp auto +P 250000 +A 16 +K true -rsh ssh -noshell -proto_dist inet_tcp -sname tsung_controller -setcookie tsung -boot /opt/erl/lib/erlang//lib/tsung_controller-1.4.2/priv/tsung_controller -boot_var TSUNGPATH /opt/erl/lib/erlang/ -pa /opt/erl/lib/erlang//lib/tsung-1.4.2/ebin -pa /opt/erl/lib/erlang//lib/tsung_controller-1.4.2/ebin -tsung_controller smp_disable true -tsung_controller debug_level 5 -tsung_controller warm_time 10 -tsung_controller config_file "/home/dp/.tsung/tsung.xml" -tsung_controller log_dir "/home/dp/.tsung/log/" -tsung_controller mon_file "tsung.log"

emacs的debug,无法从tsung启动,只能是在一个erl shell上启动tsung_controller:start(). 
解决办法,emacs启动erl shell 后,手动set env

在src/tsung_controller/tsung_controller.app

env参数加入 

{config_file ,"/home/dp/.tsung/tsung.xml"},
 {log_dir ,"/home/dp/.tsung/log/"},
{mon_file, "tsung.log"}

对应你自己的路径。

然后在 emacs的erlang shell 中把tsung的依赖启动。

application:start(crypto),application:start(public_key),application:start(ssl),application:start(tsung_controller).

就可以把tsung debug 启动了。


------------------------------------------------------------------------------------分界线------------------------------------------------------------------------------------------

其实,tsungdebug 还可以由emacs连接到tsung 的节点。tsung启动 脚本,带有debug 选项。但是我试不成功。只能用这个笨方法






                              ~ by dp



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值