leopard, 一個線上程式碼除錯框架
leopard是一個線上程式碼除錯框架。
如果你有下列需求,可以使用這個框架
(1)動態修改線上程式的一些配置引數,比如說,執行緒池的數目,timeout的閾值等
(2)得到線上程式的一些狀態,比如,搜尋引擎中,一個請求對應的排序後文件列表
leopard提供了一個註冊callback機制,使用者只需提供實現自己的callback函式,並註冊到一個唯一的路徑,就可以線上的按照指定的路徑來請求函式,並得到相應的結果。
leopard使用非常簡單,直接嵌入到你的程式中即可。具體使用步驟可以參考提供的例子。
#include <string>
#include <utility>
#include <vector>
#include <boost/bind.hpp>
#include "cpp_leopard/leopard/leopard.h"
using namespace cpp_leopard::leopard;
using namespace std;
// Note:
// For convenience, this file unit does not follow the
// google coding style in a way.
typedef vector<pair<string, string> > vector_pair_type;
string non_member_function(const vector_pair_type& parameters) {
return "A non-member function";;
}
class Foo {
public:
string operator() (const vector_pair_type& parameters) {
return "A function object";
}
string NonStaticMemberFunction(const vector_pair_type& parameters) const {
return "A non-static member function";
}
static string StaticMemberFunction(const vector_pair_type& parameters) {
return "A static member function";
}
};
int main() {
AbstractHttpServer& server = GetDefaultServer();
RegisterCommonHandlers(&server);
if (!server.Start()) {
return -1;
}
// Register a free function(non-member function)
server.RegisterHandler("/function/non_member_function",
non_member_function);
// Register a functor(function object)
server.RegisterHandler("/function/function_object", Foo());
// Register a static member function
server.RegisterHandler("/function/static_member_function",
Foo::StaticMemberFunction);
// Register a member function with boost::bind or std::bindxxx
// Note: I have a while loop below, so the local var 'foo' will
// never be destroyed. It's just an example here. Beware don't
// do this in your project.
Foo foo;
server.RegisterHandler("/function/non_static_member_function",
boost::bind(&Foo::NonStaticMemberFunction, &foo, _1));
while (true) {
sleep(10);
}
}
注意:
(1)提供了C++的版本,後續會推出java等版本。
(2)不支援跨平臺,目前僅支援unix/linux平臺
(3)leopard採用騰訊開源的blade編譯工具進行編譯
(4)非常輕量級,基本不會影響線上程式的效能
(5)leopard採用一個輕量級的web server,mongoose來提供http通訊服務。 使用者也可以定製,只需實現相應的介面即可。
(6)執行緒安全
具體專案已開源在github上,請關注https://github.com/JianboZhu/leopard
相關文章
- 優雅地除錯線上程式碼除錯
- Arthas線上java程式診斷工具 線上除錯神器Java除錯
- Python 程式碼除錯—使用 pdb 除錯Python除錯
- GDB 除錯程式碼除錯
- ZanProxy —— 原生程式碼除錯線上頁面,環境再也不是問題除錯
- vue 程式碼除錯神器Vue除錯
- 真香,擼一個SpringBoot線上程式碼修改器Spring Boot
- 一款小而美的線上串列埠除錯工具串列埠除錯
- Mqtt入門:線上除錯連線阿里雲MQQT除錯阿里
- 使用 vscode 除錯前端程式碼VSCode除錯前端
- phpstorm 使用 Xdebug 除錯程式碼PHPORM除錯
- VS Code除錯C程式碼除錯C程式
- Python之PySnooper程式碼除錯PythonOOP除錯
- 使用 Java 框架 Scipio ERP 建立一個線上商店Java框架
- 使用 VSCode 除錯 Electron 主程式程式碼VSCode除錯
- 一路踩坑,被迫聊聊 C# 程式碼除錯技巧和遠端除錯C#除錯
- 在Linux上使用vscode編譯除錯C/C++程式碼LinuxVSCode編譯除錯C++
- phpstorm 遠端除錯 homstead 程式碼PHPORM除錯
- android studio 除錯 framework 層程式碼Android除錯Framework
- 如何在vscode中除錯程式碼?VSCode除錯
- 推薦程式碼除錯工具 Xdebug除錯
- Android Studio程式碼除錯技巧篇Android除錯
- 10個線上HTML程式碼編輯器HTML
- 手把手教你除錯構建一個Vue/小程式商城專案原始碼除錯Vue原始碼
- 線上追蹤壓縮後的JS出錯程式碼JS
- gdbserver連線Ubuntu除錯程式(使用串列埠)ServerUbuntu除錯串列埠
- 在MacOS上使用gdb(cgdb)除錯Golang程式Mac除錯Golang
- 程式碼除錯的N種姿勢除錯
- vsc 如何除錯遠端python程式碼除錯Python
- Emscripten教程之如何除錯程式碼(六)除錯
- 程式碼除錯技巧【OI縮水版】除錯
- 使用GDB除錯Android Native 層程式碼除錯Android
- Windows windbg kernel debug 雙機核心除錯 - USB3.0 除錯 USB除錯 除錯線Windows除錯
- 聊一聊 GDB 除錯程式時的幾個實用命令除錯
- android 無線除錯Android除錯
- JavaScript Source Code對映引起的一個SAP C4C程式碼除錯問題JavaScriptC程式除錯
- 用友雲開發者中心助你上雲系列之線上除錯除錯
- windows上通過IDA遠端除錯linux程式Windows除錯Linux
- 程式碼上線的shell指令碼指令碼