博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux x64 下 Matlab R2013a 300 kb 脚本文件调试的 CPU 占用过高问题的解决办法
阅读量:6441 次
发布时间:2019-06-23

本文共 4442 字,大约阅读时间需要 14 分钟。

(1) 系统+软件版本

     CentOS 6.5 (Final), 64 位,内核initramfs-2.6.32-431.5.1.el6.x86_64,

     MATLAB Version: 8.1.0.604 (R2013a)

     Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode

(2) 问题描述

     通常在这个环境下,小文件的代码都可以调试通过.

     最近,把所有函数集合到一个M文件(332.4 kb),只是简单地设置了几个断点, 运行到断点位置再停止运行, cpu和内存占用都还算正常.

     但接下来对m文件的编辑就开始变得非常慢, 甚至是只添加几个单词就会卡住, 一直没有响应, 内存占用不变, 而1/4核CPU的占用高达100%, 只能从系统监视器里杀死进程. 

     我猜想, Matlab对M文件大小的支持,是不是非常有限? 子函数版本太多也是罪过,想着集成起来可以方便调用和标注,没想到弄巧成拙了...

 

(3) 解决办法

找到两个解决办法.

一是使用 '-singleCompThread' 参数启动matlab. 亲测可用. 调试编辑都和原来基本一样, 不再卡顿了. 这要感谢水木网友 @RSVP 的耐心解答.

[usr@usr ~]$ matlab -help    Usage:  matlab [-h|-help] | [-n | -e]                   [-arch | v=variant | v=arch/variant]                   [-c licensefile] [-display Xdisplay | -nodisplay]                   [-nosplash] [-mwvisual visualid] [-debug] [-softwareopengl]                   [-desktop | -nodesktop | -nojvm]                   [-r MATLAB_command] [-logfile log]                   [-Ddebugger [options]]    -h|-help             - Display arguments.    -n                   - Display final environment variables,                           arguments, and other diagnostic                           information. MATLAB is not run.    -e                   - Display ALL the environment variables and                           their values to standard output. MATLAB                           is not run. If the exit status is not                           0 on return then the variables and values                           may not be correct.    -arch                - Start MATLAB assuming architecture arch.    v=variant            - Start the version of MATLAB found                           in bin/glnxa64/variant instead of bin/glnxa64.    v=arch/variant       - Start the version of MATLAB found                           in bin/arch/variant instead of bin/glnxa64.    -c licensefile       - Set location of the license file that MATLAB                           should use.  It can have the form port@host or                           be a colon separated list of license files.                           The LM_LICENSE_FILE and MLM_LICENSE_FILE                           environment variables will be ignored.    -display Xdisplay    - Send X commands to X server display, Xdisplay.    -nodisplay           - Do not display any X commands. The MATLAB                           desktop will not be started. However, unless                           -nojvm is also provided the Java virtual machine                           will be started.    -nosplash            - Do not display the splash screen during startup.    -mwvisual visualid   - The default X visual to use for figure windows.    -debug               - Provide debugging information especially for X                           based problems.    -desktop             - Allow the MATLAB desktop to be started by a                           process without a controlling terminal. This is                           usually a required command line argument when                           attempting to start MATLAB from a window manager                           menu or desktop icon.    -nodesktop           - Do not start the MATLAB desktop. Use the current                           terminal for commands. The Java virtual machine                           will be started.    -singleCompThread    - Limit MATLAB to a single computational thread.                            By default, MATLAB makes use of the multithreading                            capabilities of the computer on which it is running.    -nojvm               - Shut off all Java support by not starting the                           Java virtual machine. In particular the MATLAB                           desktop will not be started.    -jdb [port]          - Enable remote Java debugging on port (default 4444)    -r MATLAB_command    - Start MATLAB and execute the MATLAB_command.    -logfile log         - Make a copy of any output to the command window                           in file log. This includes all crash reports.    -Ddebugger [options] - Start debugger to debug MATLAB.    -nouserjavapath      - Ignore custom javaclasspath.txt and javalibrarypath.txt files.

 

二是使用外部编辑器 Emacs 来编辑和调试. 调试采用 matlab-shell mode, 稍微复杂一些, 传统的快捷键都不怎么能用, 只能用命令设置断点和运行, 涉及到的命令有: dbstop & dbstatus & dbcont & dbquit 等, 可参阅这篇博客. 在调试过程中编辑脚本也没问题, matlab 占用也小. 有关 Emacs 多窗口之间切换的快捷键可以参考 .

 

全文完.

 

转载于:https://www.cnblogs.com/snake553/p/5357808.html

你可能感兴趣的文章
xss***代码
查看>>
Python学习网站
查看>>
mybatis基础(一)
查看>>
Python的Django框架中的Context使用
查看>>
我的友情链接
查看>>
linux常用命令
查看>>
Docker在Windows系统下的安装及简单使用介绍
查看>>
CentOS用yum安装X Window
查看>>
gpfs 修改 副本数
查看>>
Ubuntu16.4安装Wordpress
查看>>
模块和包
查看>>
socket编程总结
查看>>
逻辑回归模型(LR)
查看>>
List container
查看>>
20. Valid Parentheses(用栈实现括号匹配)
查看>>
推荐数据库、Web、Net、架构的PDF数据,书不在多,在看!
查看>>
[读书笔记]JavaScript 闭包(Closures)
查看>>
Django restfulframework 开发相关知识 整理
查看>>
linux信息查看手记
查看>>
Delphi考虑sql注入 QuotedStr
查看>>