Skip to content

Instantly share code, notes, and snippets.

@alprut
Last active September 23, 2019 10:27
Show Gist options
  • Save alprut/4b36ad4bd8fea75b78fdcceae1a64a88 to your computer and use it in GitHub Desktop.
Save alprut/4b36ad4bd8fea75b78fdcceae1a64a88 to your computer and use it in GitHub Desktop.
1001 nodes simulation with Contiki-NG

1001 nodes simulation with Contiki-NG

Simulation speed result

4.893 seconds simulation took about 20 minutes. Cooja GUI showed the speed under 0.40% in most periods.

Statistics

At about 1 second simulation

$ top
Tasks: 226 total,   1 running, 181 sleeping,   0 stopped,   0 zombie
%Cpu0  :  6.0 us,  1.0 sy,  0.0 ni, 93.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  : 99.7 us,  0.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st
%Cpu2  :  3.7 us,  0.3 sy,  0.0 ni, 95.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu3  :  4.0 us,  0.7 sy,  0.0 ni, 95.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  8063176 total,  3293768 free,  3982984 used,   786424 buff/cache
KiB Swap:  1459804 total,  1459804 free,        0 used.  3801616 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                         
 2753 alprut    20   0 6863760 2.632g  35852 S 104.3 34.2  13:11.91 java                            
 1411 alprut    20   0 4309856 331668 114812 S   7.3  4.1   3:08.00 gnome-shell                     
 1248 alprut    20   0  765072 114984  63360 S   4.6  1.4   1:40.66 Xorg                            
  857 gdm       20   0 3737696 210628  94132 S   0.3  2.6   0:05.94 gnome-shell                     
 2720 alprut    20   0 5210024 244032  41012 S   0.3  3.0   0:08.96 java    

At about 4.55 seconds simulation

Tasks: 228 total,   1 running, 181 sleeping,   0 stopped,   0 zombie
%Cpu0  : 21.0 us,  0.7 sy,  0.0 ni, 78.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  : 19.9 us,  0.7 sy,  0.0 ni, 79.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu2  : 80.5 us, 13.8 sy,  0.0 ni,  5.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu3  : 99.0 us,  0.0 sy,  0.0 ni,  1.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  8063176 total,  3140208 free,  4136324 used,   786644 buff/cache
KiB Swap:  1459804 total,  1459804 free,        0 used.  3648292 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                         
 2753 alprut    20   0 6997928 2.776g  35852 S 223.8 36.1  20:13.52 java                            
 1248 alprut    20   0  765072 114984  63360 S  11.6  1.4   2:10.14 Xorg                            
 1411 alprut    20   0 4309856 331776 114812 S   6.3  4.1   3:41.70 gnome-shell                     
 2720 alprut    20   0 5210024 244032  41012 S   0.3  3.0   0:09.85 java    

After 4.893 seconds simulation...

     [java]  INFO [Thread-0] (TimeLine.java:567) - Zoom level: 500.0 microseconds/pixel 
     [java]  INFO [Thread-1] (Simulation.java:253) - Simulation main loop started, system time: 1569230578188
     [java] Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
     [java] Exception in thread "TimerQueue" java.lang.OutOfMemoryError: Java heap space
     [java] Exception in thread "Thread-1" java.lang.OutOfMemoryError: Java heap space

Hardware

  • MacBook Pro(13-inch, 2018)
  • Intel Core i5-8259U 2.3GHzx4
  • Memory: 16GB 2133MHz LPDDR3

Virtualization

  • VirtualBox 5.2.22 r126460
  • Allocated Memory: 8192MB
  • Allocated Virtual CPUs: 4

Linux

Ubuntu 18.04.3 LTS 64bits (Desktop)

$ cat /proc/meminfo 
MemTotal:        8063176 kB
MemFree:         6724892 kB
MemAvailable:    6965064 kB
Buffers:           30596 kB
Cached:           436128 kB
SwapCached:            0 kB
Active:           853392 kB
Inactive:         313452 kB
Active(anon):     700940 kB
Inactive(anon):    22292 kB
Active(file):     152452 kB
Inactive(file):   291160 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       1459804 kB
SwapFree:        1459804 kB
Dirty:               608 kB
Writeback:             0 kB
AnonPages:        700148 kB
Mapped:           234876 kB
Shmem:             23104 kB
KReclaimable:      30968 kB
Slab:              64916 kB
SReclaimable:      30968 kB
SUnreclaim:        33948 kB
KernelStack:        8576 kB
PageTables:        37864 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     5491392 kB
Committed_AS:    4260560 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:             1072 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      120768 kB
DirectMap2M:     8165376 kB

$ cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 142
model name	: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
stepping	: 10
cpu MHz		: 2304.000
cache size	: 6144 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 4
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed clflushopt flush_l1d
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 4608.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 142
model name	: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
stepping	: 10
cpu MHz		: 2304.000
cache size	: 6144 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 4
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed clflushopt flush_l1d
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 4608.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 142
model name	: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
stepping	: 10
cpu MHz		: 2304.000
cache size	: 6144 KB
physical id	: 0
siblings	: 4
core id		: 2
cpu cores	: 4
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed clflushopt flush_l1d
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 4608.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 142
model name	: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
stepping	: 10
cpu MHz		: 2304.000
cache size	: 6144 KB
physical id	: 0
siblings	: 4
core id		: 3
cpu cores	: 4
apicid		: 3
initial apicid	: 3
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed clflushopt flush_l1d
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 4608.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

Contiki-NG

repository: https://github.com/contiki-ng/contiki-ng.git git commit: 93e10923e4903b2525c31cf9e465603147583e02

Cooja

repository: https://github.com/contiki-ng/cooja.git git commit: 63538bbb882ba06a7b8cf97c11ce2fe4d22e4f88 Allocated memory: 3048MB

$ cd tools/cooja
$ git diff
diff --git a/build.xml b/build.xml
index 22a2983d..1f4dd1f6 100644
--- a/build.xml
+++ b/build.xml
@@ -180,7 +180,7 @@ The COOJA Simulator
   </target>
 
   <target name="run_bigmem" depends="init, compile, jar, copy configs">
-    <java fork="yes" dir="${build}" classname="org.contikios.cooja.Cooja" maxmemory="1536m">
+    <java fork="yes" dir="${build}" classname="org.contikios.cooja.Cooja" maxmemory="3048m">
       <arg line="${args}"/>
       <env key="LD_LIBRARY_PATH" value="."/>
       <classpath>

run cooja as follows

$ cd tools/cooja
$ ant run_bigmem

Simulation condition on Cooja

  • Model: UDGM
  • Random positioning, the xyz intervals are 0 - 100.
  • Motes
    • 1000 Sky Motes: example/rpl-udp/udp-client.c
    • 1 Sky Mote: example/rpl-udp/udp-server.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment