原创 計算進程的cpu使用率 gnuplot 作圖 cpu使用率曲線示意圖
一,cpu使用率計算代碼: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> #i
原创 如何設置LINUX的共享內存
安裝postgresDB時,出現如下錯誤: [postgres@localhost ~]$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data FATAL: could
原创 在Linux中增加swap空間
在安裝Linux的時候,不知道swap空間分配多少比較好,所以會隨便分配一個,在真正使用的時候,比如安裝Oracle10g會要求很大的swap空間,發現swap空間不夠,那應該怎麼增加swap空間大小呢。
原创 linux下如何統計一個目錄下的文件個數以及代碼總行數的命令
linux下如何統計一個目錄下的文件個數以及代碼總行數的命令 知道指定後綴名的文件總個數命令: find . -name "*.cpp" | wc -l 知道一個目錄下代碼總行數以及單個文件行數: find . -name "*.h"
原创 centos 64 位系統安裝postgresql odbc 方法
1,64位系統下,postgresql 的psqlodbc驅動下載地址 http://www.postgresql.org/ftp/odbc/versions/src/ 2,64位系統下,安裝psq
原创 非root 用戶用root權限執行程序的設置方法
非root 用戶用root權限執行程序的設置方法: 假設需要執行的程序是 controller_test.用root用戶設置步驟如下: 1, 設置所屬用戶與屬組爲 root [root@localhost ~]
原创 localtime_r的替代實現
struct tm * my_localtime_r(const time_t *srctime,struct tm *tm_time) { long int n32_Pass4year,n32_hpery; // 每
原创 在程序中判斷一個文件是否可讀的方法
bool canRead(string _path) { assert (!_path.empty()); struct stat st; if (stat(_path.c_str(), &st) == 0) { if (g