lcnt 环境搭建

抄书:otp_doc_html_R13B04/lib/tools-2.6.5.1/doc/html/lcnt_chapter.html#id2252207

[b]lcnt - The Lock Profiler[/b]

Internally in the Erlang runtime system locks are used to protect resources from being updated from multiple threads in a fatal way. Locks are necessary to ensure that the runtime system works properly but it also introduces a couple of limitations. Lock contention and locking overhead.

With lock contention we mean when one thread locks a resource and another thread, or threads, tries to acquire the same resource at the same time. The lock will deny the other thread access to the resource and the thread will be blocked from continuing its execution. The second thread has to wait until the first thread has completed its access to the resource and unlocked it. The lcnt tool measures these lock conflicts.

Locks has an inherent cost in execution time and memory space. It takes time initialize, destroy, aquiring or releasing locks. To decrease lock contention it some times necessary to use finer grained locking strategies. This will usually also increase the locking overhead and hence there is a tradeoff between lock contention and overhead. In general, lock contention increases with the number of threads running concurrently. The lcnt tool does not measure locking overhead.
[b]

5.1 Enabling lock-counting[/b]

For investigation of locks in the emulator we use an internal tool called lcnt (short for lock-count). The VM needs to be compiled with this option enabled. To enable this, use:

cd $ERL_TOP
./configure --enable-lock-counter


Another way to enable this alongside a normal VM is to compile it at emulator directory level, much like a debug build. To compile it this way do the following,
[i]
cd $ERL_TOP/erts/emulator
make lcnt FLAVOR=smp[/i]


and then starting Erlang with,

[i]$ERL_TOP/bin/cerl -lcnt[/i]


To verify that you lock-counting enabled check that [lock-counting] appears in the status text when the VM is started.

Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe]
[kernel-poll:false] [lock-counting]


[b]5.2 Getting started[/b]

Once you have a lock counting enabled VM the module lcnt can be used. The module is intended to be used from the current running nodes shell. To access remote nodes use lcnt:clear(Node) and lcnt:collect(Node).

All locks are continuously monitored and its statistics updated. Use lcnt:clear/0 to initially clear all counters before running any specific tests. This command will also reset the duration timer internally.

To retrieve lock statistics information use, lcnt:collect/0,1. The collect operation will start a lcnt server if it not already started. All collected data will be built into an erlang term and uploaded to the server and a duration time will also be uploaded. This duration is the time between lcnt:clear/0,1 and lcnt:collect/0,1.

Once the data is collected to the server it can be filtered, sorted and printed in many different ways.

See the reference manual for a description of each function.
MC Debug Main Switch : Default Debug Level Main Board BIOS ID = 1 Notify Manufac IPMI Success GPIO_106 Value = 1. [GetDataFromFv2] StartBase is 0xFFF70040 [VariableSyncPeimEntry] Get UpdateFlag from Cust FV: 0x24 [GetDataFromFv2] StartBase is 0xFFF10080 [VariableSyncPeimEntry] Get UpdateFlag from Backup FV: 0x24 [VariableSyncPeimEntry] VARIABLE_SYNC_HOB Data. IsFirstTimeRunFlag : 0 IsVariableSyncFlag : 0 IsApcbHashErrorFlag: 0 cPcdBiosDebugModeFinalSwitch: 0x0 FsAdjustHostPCIBusMapPeim start Disable adjusting the host PCI bus map. mIpmiLibCheckManufacNotifyDesc [Info] I3cMasterPei.c NumberOfSockets: 2. Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 :0x2DC2000 is SMN Get 2th Skt FCH bus: 0x80 Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 :0x2DC3000 is SMN Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 :0x2DD4000 is SMN Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 :0x2DD5000 is SMN Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 :0x2DD6000 is SMN Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 :0x2DDB000 is SMN Standard-mode HCNT:LCNT = 645:855 Fast-mode HCNT:LCNT = 135:240 Pei Get Apcb Success 8372E3E
07-18
(defun c:d2(/ aCen cAng cCen cPl cRad cReg fDr it lCnt lLst mSp pCen pT1 pT2 ptLst R tHt tLst vlaPl vlaTab vLst cTxt oldCol nPl clFlg actDoc tPt1 tPt2 cAng tiPt oSnp *error*) (vl-load-com) (defun Extract_DXF_Values(Ent Code) (mapcar 'cdr (vl-remove-if-not '(lambda(a)(=(car a)Code)) (entget Ent))) ); end of (defun *error*(msg) (setvar "CMDECHO" 1) (if oSnp(setvar "OSMODE" oSnp)) (if mSp(vla-EndUndoMark actDoc)) (princ) ); end of *error* (if (and (setq cPl(entsel "\n选择多段线 ")) (= "LWPOLYLINE"(car(Extract_DXF_Values(car cPl)0))) ); end and (progn (princ "\n稍等... \n") (setq vlaPl(vlax-ename->vla-object(car cPl)) ptLst(mapcar 'append (setq vLst(Extract_DXF_Values(car cPl)10)) (mapcar 'list(Extract_DXF_Values(car cPl)42))) r 2 lCnt 0 tLst '((1 0 "孔号")(1 1 "X")(1 2 "Y")(1 3 "Z")) actDoc(vla-get-ActiveDocument (vlax-get-acad-object)) mSp(vla-get-ModelSpace actDoc) tHt(getvar "TEXTSIZE") ); end setq (vla-StartUndoMark actDoc) (setvar "CMDECHO" 0) (setq oSnp(getvar "OSMODE")) (foreach vert ptLst (setq vert(trans vert 0 1) tLst(append tLst (list(list r 0(itoa(1+ lCnt))) (list r 1(rtos(car vert)2 1)) (list r 2(rtos(cadr vert)2 1)) (list r 3 "")))) (if(and (/= 0.0(last vert)) (setq pt1(vlax-curve-GetPointAtParam vlaPl lCnt)) (setq pt2(vlax-curve-GetPointAtParam vlaPl(1+ lCnt))) ); end and (setq r(1+ r) cRad(abs(/(distance pt1 pt2) 2(sin(/(* 4(atan(abs(last vert))))2)))) aCen(vlax-curve-GetPointAtParam vlaPl(+ 0.5 lCnt)) fDr(vlax-curve-getFirstDeriv vlaPl (vlax-curve-getParamAtPoint vlaPl aCen)) pCen(trans (polar aCen(-(if(minusp(last vert)) pi(* 2 pi)) (atan(/(car fDr)(cadr fDr))))cRad)0 1) tLst(append tLst(list (list r 0 "center") (list r 1(rtos(car pCen)2 1)) (list r 2(rtos(cadr pCen)2 1)) (list r 3(rtos cRad 2 1)))) ); end setq ); end if (setq r(1+ r) lCnt(1+ lCnt)) ); end foreach (setq vlaTab(vla-AddTable mSp (vlax-3D-point '(0 0 0)) (+ 1(/(length tLst)4)) 4 (* 3 tHt)(* 10 tHt))) (foreach i tLst (vl-catch-all-apply 'vla-SetText(cons vlaTab i)) (vla-SetCellTextHeight vlaTab(car i)(cadr i)tHt) (vla-SetCellAlignment vlaTab(car i)(cadr i)acMiddleCenter) ); end foreach (vla-put-VertCellMargin vlaTab (* 0.75 tHt)) (vla-put-Height vlaTab(* 1.75(/(length tLst)4))) (vla-SetColumnWidth vlaTab 0 (* 5 tHt)) (vla-SetColumnWidth vlaTab 0 (* 5 tHt)) ;;; (vla-put-RepeatTopLabels vlaTab :vlax-true) ;;; (vla-put-BreakSpacing vlaTab (* 3 tHt)) (vla-DeleteRows vlaTab 0 1) (princ "\n-->指定插入点 ") (command "_.copybase" (trans '(0 0 0)0 1)(entlast) "") (command "_.erase" (entlast) "") (command "_.pasteclip" pause) (if(= :vlax-true(vla-get-Closed vlaPl)) (progn (setq nPl(vla-Copy vlaPl)) (command "_.region" (entlast) "") (setq cCen(vlax-get(setq cReg (vlax-ename->vla-object(entlast)))'Centroid)) (vla-Delete cReg) (setq clFlg T) ); end progn ); end if (setq lCnt 0) (foreach v vLst (if clFlg (setq cAng(angle cCen(trans v 0 1)) iPt(polar v cAng (* 2 tHt))) (setq tPt1(vlax-curve-GetPointAtParam vlaPl (- lCnt 0.0000001)) tPt2(vlax-curve-GetPointAtParam vlaPl (+ lCnt 0.0000001)) iPt(polar v(+(* pi 0.5)(if(minusp (setq cAng(angle tPt1(if tPt2 tPt2 (polar tPt1(* 0.5 pi)0.0000001))))) cAng(- cAng)))(* 2 tHt)) ); end setq ); end if (setvar "OSMODE" 0) (setq cTxt(vla-AddText mSp(itoa(1+ lCnt)) (vlax-3d-point iPt) tHt) tiPt(vla-get-InsertionPoint cTxt) lCnt(1+ lCnt) ); end setq ); end foreach (setvar "OSMODE" oSnp) (setvar "CMDECHO" 1) (vla-EndUndoMark actDoc) ); end progn (princ "\n<!> It isn't LwPolyline! Quit. <!> ") ); end if (gc) (princ) ); end of c:d2选择多线LWPOLYLINE改为点
09-06
考虑柔性负荷的综合能源系统低碳经济优化调度【考虑碳交易机制】(Matlab代码实现)内容概要:本文围绕“考虑柔性负荷的综合能源系统低碳经济优化调度”展开,重点研究在碳交易机制下如何实现综合能源系统的低碳化与经济性协同优化。通过构建包含风电、光伏、储能、柔性负荷等多种能源形式的系统模型,结合碳交易成本与能源调度成本,提出优化调度策略,以降低碳排放并提升系统运行经济性。文中采用Matlab进行仿真代码实现,验证了所提模型在平衡能源供需、平抑可再生能源波动、引导柔性负荷参与调度等方面的有效性,为低碳能源系统的设计与运行提供了技术支撑。; 适合人群:具备一定电力系统、能源系统背景,熟悉Matlab编程,从事能源优化、低碳调度、综合能源系统等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①研究碳交易机制对综合能源系统调度决策的影响;②实现柔性负荷在削峰填谷、促进可再生能源消纳中的作用;③掌握基于Matlab的能源系统建模与优化求解方法;④为实际综合能源项目提供低碳经济调度方案参考。; 阅读建议:建议读者结合Matlab代码深入理解模型构建与求解过程,重点关注目标函数设计、约束条件设置及碳交易成本的量化方式,可进一步扩展至多能互补、需求响应等场景进行二次开发与仿真验证。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值