Friday, April 10, 2009

install netfpga on ubuntu

Here is the instruction from netfpga to install netfpga on ubuntu.

1. Install prerequites

sudo apt-get install build-essential (for compiling driver)
sudo apt-get install linux-headers-`uname -r` (for compiling driver)
sudo apt-get install ncurses-dev (for selftest)
sudo apt-get install libnet1-dev (for the reference router/selftest)
sudo apt-get install libxml-simple-perl (Used in ./nf21_run_test.pl to verify *simulator* output)
sudo apt-get install libio-interface-perl (Used to manually build a newer version of Net::PCap)
sudo apt-get install liblist-moreutils-perl (Used to manually build a newer version of Net::RawIP)
sudo apt-get install liberror-perl (for the reference router)
sudo apt-get install sun-java6-jre (for the reference router GUI)
sudo apt-get install sun-java6-jdk
sudo apt-get install jpackage-utils
sudo apt-get install libpcap0.8 (for SCONE)
sudo apt-get install libpcap0.8-dev (for SCONE)



2. Create symbol links

sudo ln /usr/bin/lspci /sbin/lspci
sudo ln /usr/bin/setpci /sbin/setpci


3. Modify the source code

projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/reference_nic/regress/test_loopback_drop/run: usleep 10;
projects/router_buffer_sizing/regress/test_time_stamp/send_pkt: `usleep 10000`;
projects/router_buffer_sizing/regress/test_store_event/send_pkt: `usleep 10000`;

replace "usleep 10;" with "sleep 0.000010;"


4. Prepare env

source /root/netfpga/NF2/bashrc_addon


5. make; make install;

6. modify grub

title Ubuntu 8.04.1, kernel 2.6.24-19-server (netfpga)
uppermem 524288
root (hd0,1)
kernel /boot/vmlinuz-2.6.24-19-server root=UUID=5c9521ed-d36d-417a-a755-36e3bb5d1887 ro quiet splash vmalloc=256M
initrd /boot/initrd.img-2.6.24-19-server
quiet


7. After reboot, testing

sudo cpci_reprogram.pl --all
sudo nf2_download ~/NF2/bitfiles/reference_nic.bit
sudo ~/NF2/bin/nf21_regress_test.pl

Tuesday, March 03, 2009

add IE8 search provider

There is no interface for you to build search providers for IE8. You need this one IE Search Provider Builder Tool

Friday, February 20, 2009

Quick guide to analyze performance on windows platform

There are two methods to analyze performance of windows system.
  1. Use Visual Studio Team System‘s Performance Explorer to debug windows application.
  2. Use kernrate to analyze windows kernel.
To use VSTS's performance explorer, you need to install VSTS. You can use two ways to analyze an application, either sampling or instrumentation. Sampling has less overhead than the instrumentation. Basically, there are 5 steps.
  1. Run vsperfcmd to start analyzing process.
  2. Run your application
  3. Stop your application
  4. Run vsperfcmd to stop analyzing process.
  5. Use VSTS performance explorer to view the generated report.
MSDN has comprehensive guide on how to do these in details.To be honest, I prefer use command line for the first 4 steps. Beside, to view the functions' name in the report, you should properly configure the symbol path.

kernrate.exe is for windows 2000/XP/2003 to analyze kernel performance. It is included windows WDK toolkit. Running kernrate is simple, just type
kernate -j SYMBOL_PATH -z module
where -j is the symbol path of kernel modules, -z are the module you'd like to zoom in.

To download kernel symbol, you need to use symchk which is included in windows debugging tools. For example, following command download all symbols under c:\windows\system32\

symchk /r c:\windows\system32 /s  SRV*c:\symbols\*http://msdl.microsoft.com/download/symbols

Tuesday, February 10, 2009

overlapped I/O on windows

I recently studied winsock programming and discovered that overlapped I/O can be easily used to avoid buffer copy between user and system level. This is something I am not aware of on linux platform.

Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports

Tuesday, December 16, 2008

install xen on ubuntu

enviroment: ubuntu 8.04 server

1. install required packages

a. apt-get install ubuntu-xen-server
b. apt-get install vnc4server


2. configure win01.cfg

kernel='/usr/lib/xen/boot/hvmloader'
builder='hvm'
memory='1024'
device_model='/usr/lib/xen/bin/qemu-dm'

# since xen3.2, file:/ is obseleted.
disk=['phy:/dev/loop0,ioemu:hda,w',
'phy:/dev/loop1,ioemu:hdc:cdrom,r']

name='win01'

vif=['type=ioemu,bridge=eth0']

# boot from cdrom
boot='d'
vnc=1
vnclisten='0.0.0.0'
vncviewer=1
sdl=0

# usb mouse
usb=1
usbdevice='tablet'


3. create disk

dd if=/dev/zero of=/home/xen/disk.img bs=1M count=8192
losetup /dev/loop0 /home/xen/disk.img
losetup /dev/loop1 /home/xen/w2k3.iso

4. xm create win01.cfg

Thursday, November 27, 2008

data center for differnet applications

There are three different data centers:
1. for web services such as kaixin001.com, douban.com, ...
2. for data mining platform
3. for MMORPG (网游)

For 1st type:

Application logic is relatively simple
Transcation is not necessary
latency V.S. Throughput
Each application uses Ad-hoc way to provide
- blob stroage - photo, image, music
- table storage - user profile, tags,
- computing - sns graph compute, user behavior mining, global summary (tag cloud, hot topics)

flexible & uniform platform
amazon web service, google app engine, windows azure

For 2nd type: we are actually building...

For 3rd type, MMORPG (网游)
- expensive and low efficiency solution (HPC)
- big business impact
- virtual world game (secondlife, hipihi)

Monday, October 13, 2008

gnuplot and dvipdfm

dvipdfm doesn't correctly handle an eps figure whose lower-left corner is not at (0,0). To solve this problem, you need change -dEPSCrop to -sPAPERSIZE=jisb0 /dvipdfm/config/config

see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=428014

Wednesday, September 24, 2008

sync time between a cluster of window servers

==================
最简单的方法域服务器进行时间同步
net time /domain:fareast /set /y

查看本地时钟偏差
w32tm /stripchart /computer:time.windows.com /samples:5

==================
1. setup a windows server as ntp server (配置 Windows 时间服务以使用内部硬件时钟)

a. under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\
b. set AnnounceFlags to 0x5
c. run ntpserver
under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\
set Enabled to 1
d. net stop w32time && net start w32time

2. sync clients to server's clock.

a. net time /setsntp:server_IP
b. Internet time -> update now.

reference:
http://support.microsoft.com/kb/314054

Wednesday, August 27, 2008

enable hibernate in vista for desktop

1. powercfg -h on
2. disable hybrid sleep in control panel.

reference: Turn off a computer: FAQ

Friday, July 18, 2008

Enable Mouse Wheel for vmware linux guest

在Debian下首先需要安装xserver-xorg-input-vmmouse,
然后再修改/etc/X11/xorg.conf

Section "InputDevice"
Identifier "Configured Mouse"
Driver "vmmouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
EndSection

Thursday, July 17, 2008

Right click for Command Prompt (in Vista)

Add the following entries to your registry - you'll be able to right click and open any folder at the command line.

[HKEY_CLASSES_ROOT\Folder\shell\command]
@="Command & Prompt"

[HKEY_CLASSES_ROOT\Folder\shell\command\command]
@="cmd.exe /K cd %L"

Friday, May 30, 2008

安装Canon打印机(cups)

1. 安装cups系统
cupsys cupsys-bsd cupsys-client foomatic-bin samba smbclient gs-esp a2ps

Canon2900打印机使用capt驱动,需要进行特殊安装。
2. 下载最新的驱动
http://software.canon-europe.com/software/0028622.asp CAPTDRV160.tar.gz
3. 解压, 安装deb包
cndrvcups-common_1.60-1_i386.deb
cndrvcups-capt_1.60-1_i386.deb
4a. 进入cups web管理界面,添加打印机,注意选择对应的PPD文件。

4b. 命令行方式
I. Connect to samba
/usr/bin/smbclient -L NGN_PRINTER -U share
II. /usr/sbin/lpadmin -p ngnprinter -v smb://user:passwd@NGNPRINTER/CanonLBP1120 -P /root/CNCUPSLBP1120CAPTJ.PPD
/usr/bin/enable ngnprinter
/usr/sbin/accept ngnprinter
/usr/sbin/lpadmin -d ngnprinter

Wednesday, May 28, 2008

debian sarge to etch distribution upgrade

1. back up old system
dpkg --get-selections “*”

2. add new sources to /etc/apt/sources.list

3. Upgrading packages

# apt-get update
# apt-get install aptitude
# aptitude -f --with-recommends dist-upgrade

当遇到kernel的时候,选择删除。但是一定要选择安装新Kernel,否则系统无法启动。

参考:Upgrade Sarge to Etch

Tuesday, May 06, 2008

互联网带宽瓶颈和收费问题

据电信专家舒华英透露,目前宽带上95%的收入只占了5%的带宽,5%的收入来自于95%的带宽。类似BT下载等都无法为运营商带来收入,却使用了很高的带宽。而短信彩铃、语音通话等占带宽很低,收入却高。结果导致运营商不愿意扩容。


信产部官员表示要防宽带塞车但不封杀P2P

Thursday, April 24, 2008

cygwin on windows xp

由于以后要逐渐开始使用windows操作环境,现在开始熟悉cygwin下面的操作:

安装
1. 从http://cygwin.com 下载setup.exe运行
2. 选择Direct Connection
3. 选择安装的Packages
4. 安装

配置
1. 使用cygwin中的rxvt
2. 创建快捷方式

C:\cygwin\bin\rxvt.exe -e C:\cygwin\bin\bash.exe --login --rcfile %HOME%/.bashrc

Tuesday, April 22, 2008

HTC P6500试用

今天搞到一台HTC P6500,试用了一下,安装了如下软件:
1. 无线网络配置:笔记本和P6500都配置为Ad-hoc模式,笔记被配置为路由器。

2. Opera 8.60: HTC P6500的proxy有点问题,无论设置与否,wifi连接都不会试用proxy. opera 8.65只能试用系统默认配置,而8.60可以配置自己的代理。

3. 中文显式和中文输入法


参考http://gradinfo.net.edu.cn/~lgh/htcp6500/

Tuesday, March 04, 2008

论文进展

1. 经过一段时间的奋斗,前天终于把几个好些的部分写完了。现在只剩下最后一章了。
2. 今天把终结报告也发给老板了。希望能快点和他讨论,把终结报告的最终时间确定下来。
3. 下一步就是要把最后那一章写完了。大约分三步
a. 7号把实验搞定
b. 11号之前把论文初稿搞定
c. 18号吧修改后的初稿于交给老板。

继续加油!

末了贴张用gnuplot画的图吧

Friday, February 29, 2008

becoming linux kernel hackers (advice from Andrew Morton)

excepted from kernel trap.
interview took place on Feb. 14.

1. 做事情需要有目的,不能光看代码,需要动手,这就需要一个理由。
2. 现在的Linux开发的情况和2000年也许又不相同了,很多大公司加入
进来了。加入这些公司去开发内核可能才是可行的路径。
3. Andrew Morton最后一句话说的好,“There are many things to do,
and Linux doesn't really need thousands of people adding even more code.”
更多的人需要去做测试,做QA,做Bug fix.

What advice can you offer to people just learning to become kernel hackers?

Andrew Morton:
There is a great amount to learn, and you don't learn it by reading the
code, or by reading the mailing list. You have to actually get in
there and change something. It's only when you try to do the hands-on
things that you realize how much you don't know.

And to get hands-on, you need a *reason*.

Profile the kernel, try to fix a performance bottleneck.

Pick a neglected bug report off the kernel list, work it with the
originator, see if you can fix it.

Pick a neglected device driver or filesystem, try to improve it.

There are new block and net driver interfaces coming through in 2.5 -
pick a driver for which you have hardware and take care of it.

Don't spout off opinions on the kernel mailing list.

Ignore what the kernel developers say about C++.

If you need to write, say, a net driver then don't! First, take an
existing one and make it beautiful, or more correct, or twice as fast,
or add a feature. Then take that knowledge to the new driver.

One hot tip: if you spot a bug which is being ignored, send a
completely botched fix to the mailing list. This causes thousands of
kernel developers to rally to the cause. Nobody knows why this
happens. (I really have deliberately done this several times. It works).

Write a really good filesystem and VM performance measurement suite
which models real-world workloads. The existing ones are almost
useless for this, and this gap in the toolset makes it much harder to
tune filesystems, and to discover performance improvements and
regressions.

There are many things to do, and Linux doesn't really need thousands
of people adding even more code.

Hotspot@HOME and T-mobile's UMA plan


UMA简单来说就是GSM+Wifi的双模手机。允许用户在适当的时候
将通话在GSM和Wifi网络之间切换。现在T-mobile已经在北美开始
提供这种服务,Cingular是第一家。

我这里关心的是通过Wifi+Internet的链路网络是否会发生拥塞?
是否有区别服务?

Wednesday, February 27, 2008

vim中的中文行重排

今天进入博士论文写作的第2天,由于之前emacs编辑器无法输入
中文,只好新换了vim编辑器。

原来在emacs中C-q可以对段落进行重排,保持每行字符数不超过80个
英文字符。换到vi以后发现对应的命令是gq), 但要想实现中文重排,
还得安装一个插件。

从Edward G.J. Lee的vim介绍第3.6节摘录如下:


重排的功能本不是編輯器的主要功能,而是文書排版軟體的工作,
但簡單的重排也是很方便,對於中文而言,處理上得多花些工夫,
對於希望有中文重排功能的朋友,可下載 Vim script 來使用:

http://info.sayya.org/~edt1023/vim/format.vim


這是修改自日本朋友的貢獻。把他置於 $VIMRUNTIME/plugin 目錄下,
重新開啟 vim 就會生效,對於 J 及 gqap 都會考慮中文的細節。