method.java
来自「Java Op Processor java vhdl processor」· Java 代码 · 共 57 行
JAVA
57 行
package wcet;import com.jopdesign.sys.*;public class Method { /** * @param args */ public static void main(String[] args) { int ts, te, to; ts = Native.rdMem(Const.IO_CNT); te = Native.rdMem(Const.IO_CNT); to = te-ts; System.out.println(to); ts = Native.rdMem(Const.IO_CNT); // cnt with var. block cache: 15425 // cnt with single block cache: 16779 foo(); te = Native.rdMem(Const.IO_CNT); System.out.println(te-ts-to); } static void foo() { for (int i=0; i<10; ++i) { // @WCA loop=10 a(); b(); } } static void a() { int val = 123; for (int i=0; i<10; ++i) { // @WCA loop=10 val *= val; } } static void b() { int val = 123; for (int i=0; i<5; ++i) { // @WCA loop=5 val += c(); } for (int i=0; i<5; ++i) { // @WCA loop=5 val += val; } } static int c() { return 456; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?