如何测量通过Arduino的兆丰或由于一个code所占用的内存或RAM量 [英] How to measure the amount of memory or RAM consumed by a code on Arduino Mega or Due
问题描述
任何人能告诉我如何衡量对Arduino的特定code运行所消耗的RAM兆或者由于
Can anybody tell me how to measure the consumed RAM for a particular code running on Arduino Mega or Due.
推荐答案
有两种数字:这个问题的:
全局静态用法的和的当前的运行时间的
There is two kinds of numbers to this question: Global static usage and current run time.
静态估算用量可以通过添加以下行(如果不存在的话)来确定
The static estimated usage can be determined by adding the following line to (if it does not already exist)
\\ Arduino的1.5.5 \\五金\\ Arduino的\\ AVR \\ boards.txt
.\arduino-1.5.5\hardware\arduino\avr\boards.txt
uno.upload.maximum_ram_size=2048
这则允许编译器输出在下面的例子中附加二号线在IDE的结果窗口
This then allows the compiler to output the additional 2nd line in the following example in the IDE's result window
Binary sketch size: 25,880 bytes (of a 32,256 byte maximum)
Estimated used SRAM memory: 990 bytes (of a 2048 byte maximum)
要看到的存储器在任何给定点的用量。包括当前使用的存储空间,虽然仅在函数和成员存在。这包括堆和这样的。我用的特定点以下 MemoryFree库在code揭示高水。自述说明如何节省不必要的/无意使用的打印内存。
To see the amount of memory used at any given point. Including memory space currently in use, that exists while only in functions and members. This includes the HEAP and such. I use the following MemoryFree library at specific points in the code to reveal the high-water. The readme explains how to save unnecessarily/unintentionally used RAM by prints.
注:而原来的Arduino IDE 1.0.5的boards.txt文件不包含这些ram_sizes,它实际上并不使用显示器的使用。这里原来的Arduino IDE 1.5.5确实,与Arduino的战争遗留爆炸物1.0.5一起做(不支持的叉)。
Note: That while the original Arduino IDE 1.0.5's boards.txt files does contain these ram_sizes, it does not actually use display usage. Where the original Arduino IDE 1.5.5 does, along with Arduino ERW 1.0.5 does (an non-supported fork).
这篇关于如何测量通过Arduino的兆丰或由于一个code所占用的内存或RAM量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!