2015年11月13日 星期五

Introduction to Collectl tool

Please excuse my limited English ability.
I just want to practice my English translation skill!


中文原始版本:
http://sam33-home.blogspot.tw/2015/11/linux-collectl.html

--------------------------------------------------------------------------------------------------------

Collectl is a useful tool fr performance monitor in Linux operator system

There are a number of times in which you find yourself needing performance data. These can include benchmarking, monitoring a system's general heath or trying to determine what your system was doing at some time in the past. Sometimes you just want to know what the system is doing right now.

It allow us to monitor any of a broad set of subsystems which currently include cpu, disk, infiniband, memory, network, swap and so on.

official website
http://collectl.sourceforge.net/
--------------------------------------------------------------------------------------------------------

How to install this tool :

You only need to use single command in your terminal to install collectl (Ubuntu)

sudo apt-get install collectl

if it say collectl not found. Maybe you can update apt-get itself.

--------------------------------------------------------------------------------------------------------

How to use this tool :

collectl <parameters>

You can run collectl with no parameter.
Default setting is monitor cpu, harddisk and network every one second.


--------------------------------------------------------------------------------------------------------

Parameters :

-i <seconds> 

monitor frequency

For example :
collectl -i 0.5 //Monitor once every 0.5 seconds

-s[<subsys>]  what monitor information you want to show

<subsys> is monitor information short name you want to show

You can use follow command to show what monitor information your computer supporting : 

collectl --showsubsys 

For my virtual machine, it support monitor information below :


If you want to monitor cpu and memory information, you can add 'c' and 'm' to <subsys>.

For example :
collectl -scm //show cpu and memory information.
collectl -scmn //show cpu, memory and network information.

In the otherwise, collectl also support high flexibility data information output.
It can send monitor information to any server through the internet, You can write a simple socket programming tcp server by yourself to receive those information, or use some code in github to do that.

--------------------------------------------------------------------------------------------------------

This is first version inforeceiver our team use in TSCC competition. 
It's full text user interface.

https://github.com/x000032001/infoReceiver

This is final version inforeceiver our team use in TSCC competition. 
It's text user control interface but support displayed in the graph with graph.
It also support multiple computer with collectl to send data to it.

https://github.com/SAM33/infoReceiver-guiversion

Next time, I will introduction how to use infoReceiver-guiversion.

--------------------------------------------------------------------------------------------------------

Linux系統監控程式-Collectl

Practice in English :
http://sam33-home.blogspot.tw/2015/11/introduction-to-collectl-tool.html

--------------------------------------------------------------------------------------------------------
簡介:

Collectl是一個Linux作業系統效能監控的好用工具,我們常常需要監控電腦效能的相關資料,用來比較或監控系統,或是嘗試了解你的系統過去做了什麼,又或是你只是想要知道系統現在的狀況。

他能夠讓我們監控現在的處理器、硬碟、 infiniband、記憶體、網路流量、swap等等資訊。

官方網站為
http://collectl.sourceforge.net/

--------------------------------------------------------------------------------------------------------
如何安裝(Ubuntu):

只需要再終端機中輸入指令來安裝collectl

sudo apt-get install collectl

如果他說找不到 collectl的話,可能是apt-get版本太舊了,可以使用如下指令來更新apt-get

sudo apt-get update

--------------------------------------------------------------------------------------------------------
如何使用:

collectl <參數>

你可以不加任何參數來執行,預設為每秒一次監控處理器、硬碟以及網路



--------------------------------------------------------------------------------------------------------
參數說明

-i <秒> 每隔多久監測一次

EX:
collectl -i 0.5

-s[<subsys>]  要呈現那些資訊

<subsys>為要呈現哪些資訊,你可以透過指令
collectl --showsubsys 來顯示你的電腦有哪些資訊能夠被蒐集,以我的虛擬機來說
可以顯示的資料如下圖。
假設我要顯示處理器和記憶體資訊,就需要把c和m加到<subsys>去。
EX:
collectl -scm //顯示處理器和記憶體資訊
collectl -scmn //顯示處理器和記憶體以及網路資訊

另外collectl最強大的功能莫過於他的靈活性,他可以把蒐集的資料透過網路傳送出去,我們只需要透過簡易的socket programming,或是簡單的使用別人寫好的inforeceiver,就能從遠端蒐集collectl回傳的資料,方便我們一次監測多台伺服器的效能。

--------------------------------------------------------------------------------------------------------

去年去比TSCC時我們團隊的最初版本,純文字介面。
https://github.com/x000032001/infoReceiver

去年去比TSCC時我們團隊所撰寫的版本,支援多client連線、圖形化圖表功能:
https://github.com/SAM33/infoReceiver-guiversion

關於infoReceiver-guiversion之後有空會介紹怎麼使用,讀者可以先自行試看看。

--------------------------------------------------------------------------------------------------------

2015年6月27日 星期六

Installing STM32F4 Development Environment for Linux and Mac OS


1.、Download Toolchain
Visit GNU Tools for ARM Embedded Processors or just use one of the links below to download it

2、Install automake

Mac OS:
$ brew install automake
Linux:
$ sudo apt get install automake

3、Make a New Directory and decompress the tar.bz2 file you download

Mac OS:
$ cd {Your workspace}
$ mkdir toolchain
$ mv {Your download} toolchain
$ cd toolchain
$ tar -jxvf gcc-arm-none-eabi-4_9-2015q2-20150609-mac.tar.bz2

Linux:
$ cd {Your workspace}
$ mkdir toolchain
$ mv {Your download} toolchain
$ cd toolchain
$ tar -jxvf gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2

4、Set environment variable
*If you close the terminal , the environment variable set by export command will disappear . 
You need to do those things again when you open a new terminal .    
( If you want to permanently export a variable --> google it  )
$ cd {Your workspace}
$ cd toolchain/gcc-arm-none-eabi-4_9-2015q2/bin
$ export PATH=$PATH:`pwd`

5、Get st-util tool (stlink tool)

$ cd {Your workspace}
$ mkdir sttool
$ cd sttool
$ git init
$ git pull https://github.com/texane/stlink
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

6、Download stm32f4 blink example
$ cd {Your workspace}
$ mkdir blink
$ cd blink
$ git init 

$ git pull https://github.com/SAM33/STM32F4Blink.git

7、Connect your stm32f4 to computer , and open a new terminal to run st-util

Mac OS:
$ st-util

Linux:
$ sudo st-util
You will get some message like this :
Remember the port which gdbserver running .

8、Go back to last terminal and make stm32f4 blink example
$ cd {Your workspace}
$ cd blink
$ make


9、Upload elf file to stm32f4
$ cd {Your workspace}
$ cd blink
$ arm-none-eabi-gdb
(gdb) tar ext localhost:4242
(gdb) load build/blink.elf
Loading section ..............
Loading section ..............
Loading section ..............
(gdb) run
The program being debugged has been started already.
Start it from beginning? (y or n) y
//now you will see stm32f4 board blinking !!
//stop : input ctrl^c twice
ctrl^c ctrl^c
//close gdb
(gdb) ctrl^d
A debugging session is active ....
Quit anyway? (y or n) y

This command : (gdb) tar ext localhost:????   ---->  ???? is the port you remember
Enable gdb remote debuging using st-util gdb server . You will get some log in your st-util windows ,
 

2015年1月23日 星期五

研究所推甄心得 -- 中央大學軟工所

------------------------------------------------------------------------------------------------------------------

個人背景:
1.喜歡實作各種專案
2.有大專生國科會計畫
3.CPE解題三題~四題水準
4.後段國立大學,班排(系排)前三
5.畢業專題為感測網路多媒體應用相關
6.無任何證照

------------------------------------------------------------------------------------------------------------------

推甄結果:
初試(資料審查) : 88.5 (68.50可進複試)
複試(上機考) : 21.88
總和(資料審查*1.0+上機考*1.5) : 121.32 (84.38以上備取)
結果 : 正取第四名 (總共收十名正取,十四名備取)
P.S. 今年備取備到第六名

------------------------------------------------------------------------------------------------------------------

準備:
中央軟工所初試不太在意校內成績,而且好像不太會刷人(想讓大家上機分高下?),
並且要上傳(也可以不用,只要不怕低分的話...)自己做過的程式專案一份,沒有限
制任何類型,我想審查分數的關鍵應該是專案分數以及CPE成績,另外,資料採
網路上傳方式。

------------------------------------------------------------------------------------------------------------------

初試:
由於畢業專題屬於嵌入式、感測網路,我想不太適合作為軟工所上傳用的專案,
所以我將之前人工智慧相關課程的期末專題改寫來使用,此專題為一象棋對戰
平台程式+AI開發環境平台程式+2隻DEMO用的AI程式,此對戰平台程式能夠讓
兩個玩家(任一玩家都可以是AI程式或人)進行暗棋PK,平台本身用JAVA來撰寫
(圖形化+Socket),AI程式是使用C語言(Socket),平台提供特定協議來讓AI連線、
操控,AI開發環境平台程式使用C#來撰寫,讓使用者能使用此環境來設計適合
對戰平台的AI演算法,自動編譯並產生AI程式,2隻DEMO用AI程式一為DFS
演算法,另一為基因演算法...(離題了,之後有空再介紹)。

書面文件部分則是十分普通,自傳+研究計畫+獎狀,差不多就沒了。

------------------------------------------------------------------------------------------------------------------

複試:
中央軟工所的複試為純上機考,可攜帶任何書面文件,但禁止連上網際網路、
禁止隨身碟、手機等電子產品,考試時間約3個多小時,題目7題左右,全英文
命題,Online judge系統(通過了還要人工審閱斟酌扣分,沒通過直接0分,不額
外人工斟酌給分),可用C、C++、JAVA、VC++語言,但部分題目限制用C或
C++。考前會給時間安裝順手的環境,作業系統為Windows,提供CodeBlock、
visual studio 2012 (.NET4.0) 、Eclipse (剩下的忘了...),個人覺得題目有點難,
屬於較活的應用題,不像CPE有些數學題、演算法題那麼枯燥,印象中的題目
(不照題號,因為題號都忘記了...) : A、一個用C寫的遊戲,叫你改成C++架構
(用多型、繼承...),B、使用system指令外部執行程式、傳參數,並取得回傳結
果(基本上是送分題),C、大數運算(忘記有沒有限用C、C++)。

最後Online judge我只有通過2題,大數運算以及system指令,不過大家的分數
普遍不高,若在此部分表現突出,有非常高的機率能錄取。

------------------------------------------------------------------------------------------------------------------

結語:
我覺得中央軟工所十分重視程式實務能力,若對自己的實作能力有信心,認為
可以在上機考拿到高分,那應該是滿有希望的!:

------------------------------------------------------------------------------------------------------------------

Android NDK -- 環境安裝

好久沒使用JNI來撰寫Android的程式了,今日突然想來複習一下,目標為重新編譯之前的舊JNI APP專案,以此篇文章用來記錄安裝過程,方便之後溫習。

1.將專案Import到Android Studio,重新編譯 : 發生錯誤,找不到NDK


2.下載Android NDK


3.執行自動解壓縮檔案,把NDK放到想要的路徑去,在此為C槽 : 路徑C:\android-ndk-r10d

4.找到專案中的檔案local.properties


5.加入ndk.dir=<NDK路徑>  *注意跳脫字元

6.重新編譯 : 發生錯誤 (記得之前用Eclipse沒這問題)

7.爬了一下文章,貌似是個BUG,只要在jni資料夾下新增一個空的util.c就能解決@@


8.過了,傳到裝置

9.完成

2015年1月4日 星期日

Prolific USB-to-Serial Comm Port (win8 driver安裝)

換了win8之後拿來開發嵌入式系統的神器突然不能用了,就算安裝了驅動程式還是會出現黃色的驚嘆號(裝置無法啟動:代碼10...),經過幾個小時的處理,使用下列方法解決,雖然不一定每台電腦都可用,但是各位可以做個參考:
1.把驅動程式移除(裝置管理員->Prolific USB-to-Serial...->{右鍵}解除安裝驅動程式)
2.控制台->裝置與印表機->(你的電腦那圖示)->{右鍵}裝置安裝設定->否->絕不安裝...
3.手動下載驅動程式(PL2303 Prolific Driverinstaller v110)
我的Google雲端硬碟備份(怕來源不明就自己去載吧,我這也是載來的,來源不確定)
https://drive.google.com/file/d/0BycfqXTMVQ6ARlNNUHNRX0pndkk/view?usp=sharing
4.管理員權限安裝PL2303 Driver (記得拔掉您的裝置)
5.控制台->裝置與印表機->(你的電腦那圖示)->{右鍵}裝置安裝設定->是  (把自動下載復原)
6.裝置裝上去會發現Prolific USB-to-Serial Comm Port裝置的黃色驚嘆號消失了

以上...希望能幫助到您。