[
  {
    "path": ".gitattributes",
    "content": "* linguist-language=C++\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: \"[BUG]\"\nlabels: bug\nassignees: ''\n\n---\n\n**What version of TARS and what language are you using?**\n\n**What operating system (Linux, Windows, ...) and version?** [e.g. CentOS 7.8]\n\n**What runtime/compiler are you using?** [e.g. JDK version or version of gcc]\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. Go to '...'\n2. Click on '....'\n3. See error\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/custom.md",
    "content": "---\nname: Custom issue template\nabout: Describe this issue template's purpose here.\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: \"[FEATURE]\"\nlabels: enhancement\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "### What language are you using?\n \n \n### What operating system (Linux, Ubuntu, …) and version?\n \n \n### What runtime / compiler are you using (e.g. jdk version or version of gcc)\n \n \nMake sure you include information that can help us debug (full error message, exception listing, stack trace, logs).\n\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "**IMPORTANT: Please do not create a Pull Request without creating an issue first.**\n\n*Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.*\n\nPlease provide enough information so that others can review your pull request:\n\n<!-- You can skip this if you're fixing a typo or adding an app to the Showcase. -->\n\nExplain the **details** for making this change. What existing problem does the pull request solve?\n\n<!-- Example: When \"Adding a function to do X\", explain why it is necessary to have a way to do X. -->\n\n**Test plan (required)**\n\nDemonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.\n\n<!-- Make sure tests pass on both Travis and Circle CI. -->\n\n**Code formatting**\n\n<!-- See the simple style guide. -->\n\n**Closing issues**\n\nPut `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such).\n"
  },
  {
    "path": ".github/workflows/deploy-framework-docker.yml",
    "content": "name: deploy-framework-docker\n\non:\n  push:\n    tags:\n      - v*\njobs:\n  build:\n    runs-on: ubuntu-20.04 \n    steps:\n      - name: docker login\n        run: |\n          docker login -u ${{ secrets.name }} -p ${{ secrets.pass }} \n      - name: Get version\n        id: get_version\n        run: echo ::set-output name=VERSION::${GITHUB_REF/refs\\/tags\\//}\n      - uses: actions/checkout@v3\n        with:\n          submodules: true\n      - name: deploy docker\n        run: |\n          echo $GITHUB_SHA\n          ./tars-deploy-framework.sh ${{ steps.get_version.outputs.VERSION }} true\n"
  },
  {
    "path": ".github/workflows/deploy-latest-framework-docker.yml",
    "content": "name: deploy-latest-framework-docker\n\non:\n  push:\n    branches:\n      - master\n\njobs:\n  build:\n    runs-on: ubuntu-20.04\n    steps:\n      - name: docker login\n        run: |\n          docker login -u ${{ secrets.name }} -p ${{ secrets.pass }}\n      - uses: actions/checkout@v3\n        with:\n          submodules: true\n      - name: deploy docker\n        run: |\n          echo $GITHUB_SHA\n          ./tars-latest-deploy-framework.sh true\n"
  },
  {
    "path": ".github/workflows/deploy-latest-tars-docker.yml",
    "content": "name: deploy-latest-tars-docker\n\non:\n  push:\n    branches:\n      - master\njobs:\n  build:\n    runs-on: ubuntu-20.04 \n    steps:\n      - name: docker login\n        run: |\n          docker login -u ${{ secrets.name }} -p ${{ secrets.pass }} \n      - uses: actions/checkout@v3\n        with:\n          submodules: true\n      - name: deploy docker\n        run: |\n          echo $GITHUB_SHA\n          ./tars-latest-deploy-tars.sh true\n"
  },
  {
    "path": ".github/workflows/deploy-tars-docker.yml",
    "content": "name: deploy-tars-docker\n\non:\n  push:\n    tags:\n      - v*\njobs:\n  build:\n    runs-on: ubuntu-20.04 \n    steps:\n      - name: docker login\n        run: |\n          docker login -u ${{ secrets.name }} -p ${{ secrets.pass }} \n      - name: Get version\n        id: get_version\n        run: echo ::set-output name=VERSION::${GITHUB_REF/refs\\/tags\\//}\n      - uses: actions/checkout@v3\n        with:\n          submodules: true\n      - name: deploy docker\n        run: |\n          echo $GITHUB_SHA\n          ./tars-deploy-tars.sh ${{ steps.get_version.outputs.VERSION }} true\n"
  },
  {
    "path": ".gitignore",
    "content": "/java/core/.settings\n/java/core/.classpath\n/java/core/.project\n/java/examples/quickstart-client/.settings\n/java/examples/quickstart-client/.project\n/java/examples/quickstart-client/.classpath\n/java/examples/quickstart-server/.settings\n/java/examples/quickstart-server/.project\n/java/examples/quickstart-server/.classpath\n/java/net/.settings\n/java/net/.project\n/java/net/.classpath\n/java/tools/tars-maven-plugin/.settings\n/java/tools/tars-maven-plugin/.project\n/java/tools/tars-maven-plugin/.classpath\n/java/core/target\n/java/examples/quickstart-client/target\n/java/examples/quickstart-server/target\n/java/net/target\n/java/tools/tars-maven-plugin/target\n/java/examples/stress-server/.classpath\n/java/examples/stress-server/.project\n/java/examples/stress-server/.settings\n/java/examples/stress-server/target\n/java/.project\n/java/.settings/org.eclipse.m2e.core.prefs\n/java/examples/.project\n/java/examples/.settings/org.eclipse.m2e.core.prefs\n/java/tools/.project\n/java/tools/.settings/org.eclipse.m2e.core.prefs\n\n/php/.idea/*\n.idea/*\n\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"framework\"]\n\tpath = framework\n\turl = https://github.com/TarsCloud/TarsFramework\n[submodule \"cpp\"]\n\tpath = cpp\n\turl = https://github.com/TarsCloud/TarsCpp\n[submodule \"java\"]\n\tpath = java\n\turl = https://github.com/TarsCloud/TarsJava\n[submodule \"nodejs\"]\n\tpath = nodejs\n\turl = https://github.com/tars-node/Tars.js\n[submodule \"php\"]\n\tpath = php\n\turl = https://github.com/TarsPHP/TarsPHP\n[submodule \"tup\"]\n\tpath = tup\n\turl = https://github.com/TarsCloud/TarsTup\n[submodule \"web\"]\n\tpath = web\n\turl = https://github.com/TarsCloud/TarsWeb\n[submodule \"go\"]\n\tpath = go\n\turl = https://github.com/TarsCloud/TarsGo\n[submodule \"docs\"]\n\tpath = docs\n\turl = https://github.com/TarsCloud/TarsDocs\n[submodule \"docker\"]\n\tpath = docker\n\turl = https://github.com/TarsCloud/TarsDocker.git\n[submodule \"docs_en\"]\n\tpath = docs_en\n\turl = https://github.com/TarsCloud/TarsDocs_en\n"
  },
  {
    "path": "Contributing.md",
    "content": "# Contributing\n\nIf you contributed but cannot find your ID in the file, please submit PR and add your GitHub ID to **both contributing file under your contributed repo** and [Tars repo](https://github.com/TarsCloud/Tars/pulls).\n\n## Tars\n\n### Committer\n\n- ruanshudong\n- loveyacper\n- LawlietLi\n- meijing0114\n- medns\n- dpp2009\n- TOKISAKIKURUMI\n- change93\n- helloopenworld\n- meiping\n- copyrenzhe\n- bobzhangyong\n- wjx82850707\n- Spacebody\n- souldancer\n- zerolocusta\n- markshan\n\n### Contributors List\n\n- 9chu\n- Abioy\n- bartdong\n- bishaoqing\n- bobzhangyong\n- change93\n- Cnlouds\n- copyrenzhe\n- cygsxak\n- deepzliu\n- dolphinxwc\n- dpp2009\n- duoyu119\n- ETZhangSX\n- Fr1ck\n- ganziqim\n- guzitajiu\n- helloopenworld\n- higithubhi\n- isabellavieira\n- jerrylucky\n- KatharineOzil\n- kuangxc\n- lanffy\n- lanyutc\n- LawlietLee\n- LawlietLi\n- loveyacper\n- maplebeats\n- marklightning\n- mdhender\n- medns\n- meijing0114\n- meiping\n- MR-workaholic\n- munglechina\n- parchk\n- qiuxin\n- ruanshudong\n- sandyskies\n- scguoi\n- serverlessplus\n- songvy\n- souldancer\n- Spacebody\n- sy-records\n- tarstest\n- TCZWJ\n- TimmyYu\n- tinkercloud\n- TOKISAKIKURUMI\n- wjx82850707\n- youngdou\n- YoungZiyi\n- yuansx\n- yukkiball\n- zehuaiWANG\n- zerolocusta\n- BeyondWUXF\n\n## TarsCpp\n\n### Committer\n\n- ruanshudong\n- markshan\n\n### Contributors List\n\n- Abioy\n- jerrylucky\n- langio\n- marklightning\n- ruanshudong\n- shevqko\n- Spacebody\n- TCZWJ\n- viest\n- YMChenLiye\n- zhanleewo\n- BeyondWUXF\n\n## TarsBenchmark\n\n### Committer\n- forrestlinfeng\n- markshan\n\n### Contributor List\n\n- forrestlinfeng\n- wincsb\n\n## plugins\n\n- diracccc\n\n## TarsDemo\n\n- ruanshudong\n\n## TarsDocker\n\n### Committer\n\n- ruanshudong\n- markshan\n\n### Contributor List\n\n- bartdong\n- Frankie\n- franklee0817\n- ruanshudong\n- RuizhaoLi\n\n## TarsDocs\n\n### Committer\n\n- ruanshudong\n- KatharineOzil\n- bartdong\n- Cnlouds\n- markshan\n\n### Contributor List\n- bartdong\n- Cnlouds\n- danielzheng-Tencent\n- jerrylucky\n- KatharineOzil\n- meijing0114\n- ruanshudong\n- yukkiball\n- zouchengzhuo\n\n## TarsFramework\n\n### Committer\n\n- ruanshudong\n- wincsb\n- markshan\n\n### Contributor List\n- diracccc\n- ETZhangSX\n- jerrylucky\n- lanhy\n- MindHook\n- mygrsun\n- renyang9876\n- ruanshudong\n- shevqko\n- wincsb\n- ypingcn\n- yuansx\n- BeyondWUXF\n\n## TarsGo\n\n### Committer\n\n- sandyskies\n- jchalex\n- chenhengqi\n- MonkeyLi\n- tensorchen\n- rikewang\n- markshan\n- lbbniu\n\n### Contributor List\n- 0xflotus\n- agchrys\n- Andrew-M-C\n- bartdong\n- BurningXFlame\n- chenhengqi\n- Clark-zhang\n- ClaudeLiang\n- cokeboL\n- defool\n- erjanmx\n- hooligan520\n- hotWing17\n- imthx\n- jchalex\n- jyuan68\n- lanhy\n- louishlz\n- marklightning\n- maplebeats\n- mdhender\n- mjaow\n- MonkeyLi\n- mountkin\n- nickwanninger\n- philippgille\n- qiuxin\n- rbarros\n- rikewang\n- ruanshudong\n- sandyskies\n- skelway\n- TauWu\n- tensorchen\n- terryding77\n- wqliang\n- wzshiming\n- xiaoxubeii\n- xuri\n- YaffaBeauty\n- YouEclipse\n- lbbniu\n- BeyondWUXF\n\n## TarsJava\n\n### Committer\n\n- TimmyYu\n- XenoAmess\n- diracccc\n- LawlietLi\n- markshan\n\n### Contributor List\n- diracccc\n- kahn\n- LawlietLi\n- LiuMenghan\n- TimmyYu\n- walkertest\n- woodwind\n- XenoAmess\n- yukkiball\n\n## TarsPHP\n\n### Committer\n\n- meijing0114\n- bobzhangyong\n- copyrenzhe\n- dpp2009\n- markshan\n\n### Contributor List\n- bobzhangyong\n- copyrenzhe\n- cuixg\n- danielzheng-Tencent\n- dpp2009\n- meijing0114\n- wodetian55\n- medmin\n- sy-records\n\n## TarsProtocol\n\n### Committer\n- ruanshudong\n- shevqko\n- markshan\n\n### Contributor List\n- jerrylucky\n- ruanshudong\n- shevqko\n- hpeiy98\n\n## TarsWeb\n\n### Committer\n- ruanshudong\n- zouchengzhuo\n- ziyang314\n- shevqko\n- markshan\n\n### Contributor List\n- airycanon\n- ETZhangSX\n- jerrylucky\n- lanhy\n- ouliuquan\n- ruanshudong\n- sandyskies\n- shevqko\n- wjx82850707\n- ypingcn\n- ziyang314\n- zouchengzhuo\n- BeyondWUXF\n\n## TarsJMeter\n\n### Committer\n\n- boycs007\n- jnlunsb\n- markshan\n\n\n### Contributor List\n- boycs007\n- jnlunsb\n- juliuslu-tencent\n\n## TarsNodeJS\n\n### Committer\n\n- medmin\n- markshan\n\n### Contributor List\n\n- medmin\n\n## K8STARS\n### Committer\n- bartdong\n- defool\n- markshan\n\n### Contributor List\n\n- bartdong\n- defool\n- hpeiy98\n- KatharineOzil\n- andyguo1023\n\n## ArtWork\n\n- cheney-ying\n- heisewuyu16\n- Quentin-by\n\n## TarsTools\n\n### Committer\n- harveyxu-tme\n- markshan\n\n### Contributor List\n\n- harveyxu-tme\n- hpeiy98\n\n## TarsGateway\n\n### Committer\n\n- shevqko\n- markshan\n\n### Contributor List\n\n- shevqko\n- ruanshudong\n- hpeiy98\n- wincsb\n\n## TARS_Landscape\n\n### Committer\n\n- KatharineOzil\n- dankohn\n\n### Contributor List\n\n- KatharineOzil\n- dankohn\n- bartdong\n- jordinl83\n- heisewuyu16\n\n## TarsprotocolProxy\n\n### Committer\n\n- shevqko\n- eatonzhang\n- markshan\n\n### Contributor List\n\n- shevqko\n- eatonzhang\n- markshan\n- hpeiy98\n"
  },
  {
    "path": "LICENSE",
    "content": "BSD 3-Clause License\n\nCopyright (c) 2020, THE TARS FOUNDATION\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n   contributors may be used to endorse or promote products derived from\n   this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "PerfTestSoft/Readme.md",
    "content": "# Table of contents\n> * [1.Description](#main-chapter-1)\n> * [2.Framework Environment Setup](#main-chapter-2)\n> * [3.Server Side Test Software](#main-chapter-3)\n> * [4.Client Side Test Software](#main-chapter-4)\n> * [5.Note Well](#main-chapter-5)\n\n# 1. <a id=\"main-chapter-1\"></a> Description\n-  This folder is used to store the software for Tars performance Test.\n-  The test software consists of the client software and the server software.\n-  The Tars framework should be set up successfully prior to run the performance test software.\n\n\n# 2. <a id=\"main-chapter-2\"></a> Tars Framework Environment Setup\n-  In order to run the performance test, Tars framework is a must.\n-  You can setup the framework via script or do it step-by-step.\n-  Refer to the following link:\n-  https://github.com/TarsCloud/Tars/tree/master/shellDeploy\n-  https://github.com/TarsCloud/Tars#installation\n\n\n# 3. <a id=\"main-chapter-3\"></a> Server Side Test Software \n-  For the server side, \n\n\n# 4. <a id=\"main-chapter-4\"></a> Client Side Test Software\n-  For the client side, \n\n\n\n# 5. <a id=\"main-chapter-5\"></a> Note Well\n-  More informations you should pay special attention to.\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/README.md",
    "content": "该工程是Tars入门示例的代码\n\n\n目录名称 |功能\n-----------------|----------------\nTarsStressServer      |   Tars性能压测服务端的程序\nTarsStressClient      |   Tars性能压测客户端的程序\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressClient/Stress.h",
    "content": "// **********************************************************************\n// This file was generated by a TARS parser!\n// TARS version 1.1.0.\n// **********************************************************************\n\n#ifndef __STRESS_H_\n#define __STRESS_H_\n\n#include <map>\n#include <string>\n#include <vector>\n#include \"tup/Tars.h\"\nusing namespace std;\n#include \"servant/ServantProxy.h\"\n#include \"servant/Servant.h\"\n#include \"promise/promise.h\"\n\n\nnamespace Test\n{\n\n    /* callback of async proxy for client */\n    class StressPrxCallback: public tars::ServantProxyCallback\n    {\n    public:\n        virtual ~StressPrxCallback(){}\n        virtual void callback_test(tars::Int32 ret)\n        { throw std::runtime_error(\"callback_test() override incorrect.\"); }\n        virtual void callback_test_exception(tars::Int32 ret)\n        { throw std::runtime_error(\"callback_test_exception() override incorrect.\"); }\n\n        virtual void callback_testStr(tars::Int32 ret,  const std::string& sOut)\n        { throw std::runtime_error(\"callback_testStr() override incorrect.\"); }\n        virtual void callback_testStr_exception(tars::Int32 ret)\n        { throw std::runtime_error(\"callback_testStr_exception() override incorrect.\"); }\n\n    public:\n        virtual const map<std::string, std::string> & getResponseContext() const\n        {\n            CallbackThreadData * pCbtd = CallbackThreadData::getData();\n            assert(pCbtd != NULL);\n\n            if(!pCbtd->getContextValid())\n            {\n                throw TC_Exception(\"cann't get response context\");\n            }\n            return pCbtd->getResponseContext();\n        }\n\n    public:\n        virtual int onDispatch(tars::ReqMessagePtr msg)\n        {\n            static ::std::string __Stress_all[]=\n            {\n                \"test\",\n                \"testStr\"\n            };\n            pair<string*, string*> r = equal_range(__Stress_all, __Stress_all+2, string(msg->request.sFuncName));\n            if(r.first == r.second) return tars::TARSSERVERNOFUNCERR;\n            switch(r.first - __Stress_all)\n            {\n                case 0:\n                {\n                    if (msg->response.iRet != tars::TARSSERVERSUCCESS)\n                    {\n                        callback_test_exception(msg->response.iRet);\n\n                        return msg->response.iRet;\n                    }\n                    tars::TarsInputStream<tars::BufferReader> _is;\n\n                    _is.setBuffer(msg->response.sBuffer);\n                    tars::Int32 _ret;\n                    _is.read(_ret, 0, true);\n\n                    CallbackThreadData * pCbtd = CallbackThreadData::getData();\n                    assert(pCbtd != NULL);\n\n                    pCbtd->setResponseContext(msg->response.context);\n\n                    callback_test(_ret);\n\n                    pCbtd->delResponseContext();\n\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n                case 1:\n                {\n                    if (msg->response.iRet != tars::TARSSERVERSUCCESS)\n                    {\n                        callback_testStr_exception(msg->response.iRet);\n\n                        return msg->response.iRet;\n                    }\n                    tars::TarsInputStream<tars::BufferReader> _is;\n\n                    _is.setBuffer(msg->response.sBuffer);\n                    tars::Int32 _ret;\n                    _is.read(_ret, 0, true);\n\n                    std::string sOut;\n                    _is.read(sOut, 2, true);\n                    CallbackThreadData * pCbtd = CallbackThreadData::getData();\n                    assert(pCbtd != NULL);\n\n                    pCbtd->setResponseContext(msg->response.context);\n\n                    callback_testStr(_ret, sOut);\n\n                    pCbtd->delResponseContext();\n\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n            }\n            return tars::TARSSERVERNOFUNCERR;\n        }\n\n    };\n    typedef tars::TC_AutoPtr<StressPrxCallback> StressPrxCallbackPtr;\n\n    /* callback of promise async proxy for client */\n    class StressPrxCallbackPromise: public tars::ServantProxyCallback\n    {\n    public:\n        virtual ~StressPrxCallbackPromise(){}\n    public:\n        struct Promisetest: virtual public TC_HandleBase\n        {\n        public:\n            tars::Int32 _ret;\n            map<std::string, std::string> _mRspContext;\n        };\n        \n        typedef tars::TC_AutoPtr< StressPrxCallbackPromise::Promisetest > PromisetestPtr;\n\n        StressPrxCallbackPromise(const promise::Promise< StressPrxCallbackPromise::PromisetestPtr > &promise)\n        : _promise_test(promise)\n        {}\n        \n        virtual void callback_test(const StressPrxCallbackPromise::PromisetestPtr &ptr)\n        {\n            _promise_test.setValue(ptr);\n        }\n        virtual void callback_test_exception(tars::Int32 ret)\n        {\n            std::string str(\"\");\n            str += \"Function:test_exception|Ret:\";\n            str += TC_Common::tostr(ret);\n            _promise_test.setException(promise::copyException(str, ret));\n        }\n\n    protected:\n        promise::Promise< StressPrxCallbackPromise::PromisetestPtr > _promise_test;\n\n    public:\n        struct PromisetestStr: virtual public TC_HandleBase\n        {\n        public:\n            tars::Int32 _ret;\n            std::string sOut;\n            map<std::string, std::string> _mRspContext;\n        };\n        \n        typedef tars::TC_AutoPtr< StressPrxCallbackPromise::PromisetestStr > PromisetestStrPtr;\n\n        StressPrxCallbackPromise(const promise::Promise< StressPrxCallbackPromise::PromisetestStrPtr > &promise)\n        : _promise_testStr(promise)\n        {}\n        \n        virtual void callback_testStr(const StressPrxCallbackPromise::PromisetestStrPtr &ptr)\n        {\n            _promise_testStr.setValue(ptr);\n        }\n        virtual void callback_testStr_exception(tars::Int32 ret)\n        {\n            std::string str(\"\");\n            str += \"Function:testStr_exception|Ret:\";\n            str += TC_Common::tostr(ret);\n            _promise_testStr.setException(promise::copyException(str, ret));\n        }\n\n    protected:\n        promise::Promise< StressPrxCallbackPromise::PromisetestStrPtr > _promise_testStr;\n\n    public:\n        virtual int onDispatch(tars::ReqMessagePtr msg)\n        {\n            static ::std::string __Stress_all[]=\n            {\n                \"test\",\n                \"testStr\"\n            };\n\n            pair<string*, string*> r = equal_range(__Stress_all, __Stress_all+2, string(msg->request.sFuncName));\n            if(r.first == r.second) return tars::TARSSERVERNOFUNCERR;\n            switch(r.first - __Stress_all)\n            {\n                case 0:\n                {\n                    if (msg->response.iRet != tars::TARSSERVERSUCCESS)\n                    {\n                        callback_test_exception(msg->response.iRet);\n\n                        return msg->response.iRet;\n                    }\n                    tars::TarsInputStream<tars::BufferReader> _is;\n\n                    _is.setBuffer(msg->response.sBuffer);\n\n                    StressPrxCallbackPromise::PromisetestPtr ptr = new StressPrxCallbackPromise::Promisetest();\n\n                    try\n                    {\n                        _is.read(ptr->_ret, 0, true);\n\n                    }\n                    catch(std::exception &ex)\n                    {\n                        callback_test_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n                    catch(...)\n                    {\n                        callback_test_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n\n                    ptr->_mRspContext = msg->response.context;\n\n                    callback_test(ptr);\n\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n                case 1:\n                {\n                    if (msg->response.iRet != tars::TARSSERVERSUCCESS)\n                    {\n                        callback_testStr_exception(msg->response.iRet);\n\n                        return msg->response.iRet;\n                    }\n                    tars::TarsInputStream<tars::BufferReader> _is;\n\n                    _is.setBuffer(msg->response.sBuffer);\n\n                    StressPrxCallbackPromise::PromisetestStrPtr ptr = new StressPrxCallbackPromise::PromisetestStr();\n\n                    try\n                    {\n                        _is.read(ptr->_ret, 0, true);\n\n                        _is.read(ptr->sOut, 2, true);\n                    }\n                    catch(std::exception &ex)\n                    {\n                        callback_testStr_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n                    catch(...)\n                    {\n                        callback_testStr_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n\n                    ptr->_mRspContext = msg->response.context;\n\n                    callback_testStr(ptr);\n\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n            }\n            return tars::TARSSERVERNOFUNCERR;\n        }\n\n    };\n    typedef tars::TC_AutoPtr<StressPrxCallbackPromise> StressPrxCallbackPromisePtr;\n\n    /* callback of coroutine async proxy for client */\n    class StressCoroPrxCallback: public StressPrxCallback\n    {\n    public:\n        virtual ~StressCoroPrxCallback(){}\n    public:\n        virtual const map<std::string, std::string> & getResponseContext() const { return _mRspContext; }\n\n        virtual void setResponseContext(const map<std::string, std::string> &mContext) { _mRspContext = mContext; }\n\n    public:\n        int onDispatch(tars::ReqMessagePtr msg)\n        {\n            static ::std::string __Stress_all[]=\n            {\n                \"test\",\n                \"testStr\"\n            };\n\n            pair<string*, string*> r = equal_range(__Stress_all, __Stress_all+2, string(msg->request.sFuncName));\n            if(r.first == r.second) return tars::TARSSERVERNOFUNCERR;\n            switch(r.first - __Stress_all)\n            {\n                case 0:\n                {\n                    if (msg->response.iRet != tars::TARSSERVERSUCCESS)\n                    {\n                        callback_test_exception(msg->response.iRet);\n\n                        return msg->response.iRet;\n                    }\n                    tars::TarsInputStream<tars::BufferReader> _is;\n\n                    _is.setBuffer(msg->response.sBuffer);\n                    try\n                    {\n                        tars::Int32 _ret;\n                        _is.read(_ret, 0, true);\n\n                        setResponseContext(msg->response.context);\n\n                        callback_test(_ret);\n\n                    }\n                    catch(std::exception &ex)\n                    {\n                        callback_test_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n                    catch(...)\n                    {\n                        callback_test_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n                case 1:\n                {\n                    if (msg->response.iRet != tars::TARSSERVERSUCCESS)\n                    {\n                        callback_testStr_exception(msg->response.iRet);\n\n                        return msg->response.iRet;\n                    }\n                    tars::TarsInputStream<tars::BufferReader> _is;\n\n                    _is.setBuffer(msg->response.sBuffer);\n                    try\n                    {\n                        tars::Int32 _ret;\n                        _is.read(_ret, 0, true);\n\n                        std::string sOut;\n                        _is.read(sOut, 2, true);\n                        setResponseContext(msg->response.context);\n\n                        callback_testStr(_ret, sOut);\n\n                    }\n                    catch(std::exception &ex)\n                    {\n                        callback_testStr_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n                    catch(...)\n                    {\n                        callback_testStr_exception(tars::TARSCLIENTDECODEERR);\n\n                        return tars::TARSCLIENTDECODEERR;\n                    }\n\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n            }\n            return tars::TARSSERVERNOFUNCERR;\n        }\n\n    protected:\n        map<std::string, std::string> _mRspContext;\n    };\n    typedef tars::TC_AutoPtr<StressCoroPrxCallback> StressCoroPrxCallbackPtr;\n\n    /* proxy for client */\n    class StressProxy : public tars::ServantProxy\n    {\n    public:\n        typedef map<string, string> TARS_CONTEXT;\n        tars::Int32 test(const map<string, string> &context = TARS_CONTEXT(),map<string, string> * pResponseContext = NULL)\n        {\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            tars::ResponsePacket rep;\n            std::map<string, string> _mStatus;\n            tars_invoke(tars::TARSNORMAL,\"test\", _os.getByteBuffer(), context, _mStatus, rep);\n            if(pResponseContext)\n            {\n                *pResponseContext = rep.context;\n            }\n\n            tars::TarsInputStream<tars::BufferReader> _is;\n            _is.setBuffer(rep.sBuffer);\n            tars::Int32 _ret;\n            _is.read(_ret, 0, true);\n            return _ret;\n        }\n\n        void async_test(StressPrxCallbackPtr callback,const map<string, string>& context = TARS_CONTEXT())\n        {\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            std::map<string, string> _mStatus;\n            tars_invoke_async(tars::TARSNORMAL,\"test\", _os.getByteBuffer(), context, _mStatus, callback);\n        }\n        \n        promise::Future< StressPrxCallbackPromise::PromisetestPtr > promise_async_test(const map<string, string>& context)\n        {\n            promise::Promise< StressPrxCallbackPromise::PromisetestPtr > promise;\n            StressPrxCallbackPromisePtr callback = new StressPrxCallbackPromise(promise);\n\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            std::map<string, string> _mStatus;\n            tars_invoke_async(tars::TARSNORMAL,\"test\", _os.getByteBuffer(), context, _mStatus, callback);\n\n            return promise.getFuture();\n        }\n\n        void coro_test(StressCoroPrxCallbackPtr callback,const map<string, string>& context = TARS_CONTEXT())\n        {\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            std::map<string, string> _mStatus;\n            tars_invoke_async(tars::TARSNORMAL,\"test\", _os.getByteBuffer(), context, _mStatus, callback, true);\n        }\n\n        tars::Int32 testStr(const std::string & sIn,std::string &sOut,const map<string, string> &context = TARS_CONTEXT(),map<string, string> * pResponseContext = NULL)\n        {\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            _os.write(sIn, 1);\n            _os.write(sOut, 2);\n            tars::ResponsePacket rep;\n            std::map<string, string> _mStatus;\n            tars_invoke(tars::TARSNORMAL,\"testStr\", _os.getByteBuffer(), context, _mStatus, rep);\n            if(pResponseContext)\n            {\n                *pResponseContext = rep.context;\n            }\n\n            tars::TarsInputStream<tars::BufferReader> _is;\n            _is.setBuffer(rep.sBuffer);\n            tars::Int32 _ret;\n            _is.read(_ret, 0, true);\n            _is.read(sOut, 2, true);\n            return _ret;\n        }\n\n        void async_testStr(StressPrxCallbackPtr callback,const std::string &sIn,const map<string, string>& context = TARS_CONTEXT())\n        {\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            _os.write(sIn, 1);\n            std::map<string, string> _mStatus;\n            tars_invoke_async(tars::TARSNORMAL,\"testStr\", _os.getByteBuffer(), context, _mStatus, callback);\n        }\n        \n        promise::Future< StressPrxCallbackPromise::PromisetestStrPtr > promise_async_testStr(const std::string &sIn,const map<string, string>& context)\n        {\n            promise::Promise< StressPrxCallbackPromise::PromisetestStrPtr > promise;\n            StressPrxCallbackPromisePtr callback = new StressPrxCallbackPromise(promise);\n\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            _os.write(sIn, 1);\n            std::map<string, string> _mStatus;\n            tars_invoke_async(tars::TARSNORMAL,\"testStr\", _os.getByteBuffer(), context, _mStatus, callback);\n\n            return promise.getFuture();\n        }\n\n        void coro_testStr(StressCoroPrxCallbackPtr callback,const std::string &sIn,const map<string, string>& context = TARS_CONTEXT())\n        {\n            tars::TarsOutputStream<tars::BufferWriter> _os;\n            _os.write(sIn, 1);\n            std::map<string, string> _mStatus;\n            tars_invoke_async(tars::TARSNORMAL,\"testStr\", _os.getByteBuffer(), context, _mStatus, callback, true);\n        }\n\n        StressProxy* tars_hash(int64_t key)\n        {\n            return (StressProxy*)ServantProxy::tars_hash(key);\n        }\n\n        StressProxy* tars_consistent_hash(int64_t key)\n        {\n            return (StressProxy*)ServantProxy::tars_consistent_hash(key);\n        }\n\n        StressProxy* tars_set_timeout(int msecond)\n        {\n            return (StressProxy*)ServantProxy::tars_set_timeout(msecond);\n        }\n\n    };\n    typedef tars::TC_AutoPtr<StressProxy> StressPrx;\n\n    /* servant for server */\n    class Stress : public tars::Servant\n    {\n    public:\n        virtual ~Stress(){}\n        virtual tars::Int32 test(tars::TarsCurrentPtr current) = 0;\n        static void async_response_test(tars::TarsCurrentPtr current, tars::Int32 _ret)\n        {\n            if (current->getRequestVersion() == TUPVERSION )\n            {\n                UniAttribute<tars::BufferWriter, tars::BufferReader>  tarsAttr;\n                tarsAttr.setVersion(current->getRequestVersion());\n                tarsAttr.put(\"\", _ret);\n\n                vector<char> sTupResponseBuffer;\n                tarsAttr.encode(sTupResponseBuffer);\n                current->sendResponse(tars::TARSSERVERSUCCESS, sTupResponseBuffer);\n            }\n            else\n            {\n                tars::TarsOutputStream<tars::BufferWriter> _os;\n                _os.write(_ret, 0);\n\n                current->sendResponse(tars::TARSSERVERSUCCESS, _os.getByteBuffer());\n            }\n        }\n\n        virtual tars::Int32 testStr(const std::string & sIn,std::string &sOut,tars::TarsCurrentPtr current) = 0;\n        static void async_response_testStr(tars::TarsCurrentPtr current, tars::Int32 _ret, const std::string &sOut)\n        {\n            if (current->getRequestVersion() == TUPVERSION )\n            {\n                UniAttribute<tars::BufferWriter, tars::BufferReader>  tarsAttr;\n                tarsAttr.setVersion(current->getRequestVersion());\n                tarsAttr.put(\"\", _ret);\n                tarsAttr.put(\"sOut\", sOut);\n\n                vector<char> sTupResponseBuffer;\n                tarsAttr.encode(sTupResponseBuffer);\n                current->sendResponse(tars::TARSSERVERSUCCESS, sTupResponseBuffer);\n            }\n            else\n            {\n                tars::TarsOutputStream<tars::BufferWriter> _os;\n                _os.write(_ret, 0);\n\n                _os.write(sOut, 2);\n\n                current->sendResponse(tars::TARSSERVERSUCCESS, _os.getByteBuffer());\n            }\n        }\n\n    public:\n        int onDispatch(tars::TarsCurrentPtr _current, vector<char> &_sResponseBuffer)\n        {\n            static ::std::string __Test__Stress_all[]=\n            {\n                \"test\",\n                \"testStr\"\n            };\n\n            pair<string*, string*> r = equal_range(__Test__Stress_all, __Test__Stress_all+2, _current->getFuncName());\n            if(r.first == r.second) return tars::TARSSERVERNOFUNCERR;\n            switch(r.first - __Test__Stress_all)\n            {\n                case 0:\n                {\n                    tars::TarsInputStream<tars::BufferReader> _is;\n                    _is.setBuffer(_current->getRequestBuffer());\n                    if (_current->getRequestVersion() == TUPVERSION)\n                    {\n                        UniAttribute<tars::BufferWriter, tars::BufferReader>  tarsAttr;\n                        tarsAttr.setVersion(_current->getRequestVersion());\n                        tarsAttr.decode(_current->getRequestBuffer());\n                    }\n                    else\n                    {\n                    }\n                    tars::Int32 _ret = test(_current);\n                    if(_current->isResponse())\n                    {\n                        if (_current->getRequestVersion() == TUPVERSION )\n                        {\n                            UniAttribute<tars::BufferWriter, tars::BufferReader>  tarsAttr;\n                            tarsAttr.setVersion(_current->getRequestVersion());\n                            tarsAttr.put(\"\", _ret);\n                            tarsAttr.encode(_sResponseBuffer);\n                        }\n                        else\n                        {\n                            tars::TarsOutputStream<tars::BufferWriter> _os;\n                            _os.write(_ret, 0);\n                            _os.swap(_sResponseBuffer);\n                        }\n                    }\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n                case 1:\n                {\n                    tars::TarsInputStream<tars::BufferReader> _is;\n                    _is.setBuffer(_current->getRequestBuffer());\n                    std::string sIn;\n                    std::string sOut;\n                    if (_current->getRequestVersion() == TUPVERSION)\n                    {\n                        UniAttribute<tars::BufferWriter, tars::BufferReader>  tarsAttr;\n                        tarsAttr.setVersion(_current->getRequestVersion());\n                        tarsAttr.decode(_current->getRequestBuffer());\n                        tarsAttr.get(\"sIn\", sIn);\n                        tarsAttr.getByDefault(\"sOut\", sOut, sOut);\n                    }\n                    else\n                    {\n                        _is.read(sIn, 1, true);\n                        _is.read(sOut, 2, false);\n                    }\n                    tars::Int32 _ret = testStr(sIn,sOut, _current);\n                    if(_current->isResponse())\n                    {\n                        if (_current->getRequestVersion() == TUPVERSION )\n                        {\n                            UniAttribute<tars::BufferWriter, tars::BufferReader>  tarsAttr;\n                            tarsAttr.setVersion(_current->getRequestVersion());\n                            tarsAttr.put(\"\", _ret);\n                            tarsAttr.put(\"sOut\", sOut);\n                            tarsAttr.encode(_sResponseBuffer);\n                        }\n                        else\n                        {\n                            tars::TarsOutputStream<tars::BufferWriter> _os;\n                            _os.write(_ret, 0);\n                            _os.write(sOut, 2);\n                            _os.swap(_sResponseBuffer);\n                        }\n                    }\n                    return tars::TARSSERVERSUCCESS;\n\n                }\n            }\n            return tars::TARSSERVERNOFUNCERR;\n        }\n    };\n\n\n}\n\n\n\n#endif\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressClient/main.cpp",
    "content": "/**\n * Tencent is pleased to support the open source community by making Tars available.\n *\n * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use this file except \n * in compliance with the License. You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software distributed \n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR \n * CONDITIONS OF ANY KIND, either express or implied. See the License for the \n * specific language governing permissions and limitations under the License.\n */\n\n#include \"Stress.h\"\n#include \"servant/Communicator.h\"\n#include \"util/tc_thread_pool.h\"\n#include <iostream>\n\nusing namespace std;\nusing namespace Test;\nusing namespace tars;\n\nclass Test1 \n{\npublic:\n    Test1(const string &sStr,const string &netthreads);\n    Test1(){}\n    ~Test1();\n    void dohandle(int excut_num,int size);\nprivate:\n    Communicator _comm;\n    StressPrx prx;\n};\n\nTest1::Test1(const string &sStr, const string &netthreads)\n{\n    _comm.setProperty(\"locator\",\"tars.tarsregistry.QueryObj@tcp -h 192.168.1.100 -p 17890 -t 10000\");\n    _comm.setProperty(\"stat\", \"tars.tarsstat.StatObj\");\n    _comm.setProperty(\"netthread\",netthreads);\n    _comm.stringToProxy(sStr, prx);\n}\n\nTest1::~Test1()\n{\n    \n}\n\nvoid Test1::dohandle(int excut_num,int size)\n{\n    string s(size,'a');\n\n    tars::Int32 count = 0;\n    unsigned long sum = 0;\n\n    //time_t _iTime=TC_TimeProvider::getInstance()->getNowMs();\n\n    for(int i=0; i<excut_num; i++) \n    {\n        try\n        {\n\n            string ret=\"\";\n            prx->tars_set_timeout(15000)->testStr(s,ret);\n            if(ret.size() == s.size())\n            {\n                ++sum;\n                ++count;\n            }\n\n            if(count == excut_num)\n            {\n                //cout << \"pthread id: \" << pthread_self() << \" | \" << TC_TimeProvider::getInstance()->getNowMs() - _iTime << endl;\n                count = 0;\n            }\n        }\n        catch(TC_Exception &e)\n        {\n            cout << \"pthread id: \" << pthread_self() << \"id: \" << i << \"exception: \" << e.what() << endl;\n        }\n        catch(...)\n        {\n            cout << \"pthread id: \" << pthread_self() << \"id: \" << i << \"unknown exception.\" << endl;\n        }\n    }\n    cout << \"succ:\" << sum <<endl;\n}\n\nint main(int argc,char ** argv)\n{\n    if(argc != 5)\n    {\n        cout << \"usage: \" << argv[0] << \" ThreadNum CallTimes size Netthread\" << endl;\n        return -1;\n    }\n\n    string s=\"Test.TarsStressServer.StressObj\";\n    string netthreads = string(argv[4]);\n    Test1 tm(s, netthreads);\n       try\n    {\n        tars::Int32  threads = TC_Common::strto<tars::Int32>(string(argv[1]));\n        TC_ThreadPool tp;\n        tp.init(threads);\n        tp.start();    \n\n        cout << \"init tp succ\" << endl;\n\n        tars::Int32 times = TC_Common::strto<tars::Int32>(string(argv[2]));\n\ttars::Int32 size  = TC_Common::strto<tars::Int32>(string(argv[3]));\n        cout << \"times:\" << times << endl;\n\t\n\ttime_t _iTime=TC_TimeProvider::getInstance()->getNowMs();\n\n        for(int i = 0; i<threads; i++) \n        {\n            auto fw = std::bind(&Test1::dohandle, &tm, times, size);\n            tp.exec(fw);\n        }\n\n        tp.waitForAllDone(); \n        cout << \"this process time: \" << TC_TimeProvider::getInstance()->getNowMs() - _iTime << endl;\n    }\n    catch(exception &e)\n    {\n        cout<<e.what()<<endl;\n    }\n    catch(...)\n    {\n        \n    }\n    \n    return 0;\n}\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressClient/makefile",
    "content": "\n#-----------------------------------------------------------------------\n\nAPP       := Test\nTARGET    := TarsStressClient\nCONFIG    := \nSTRIP_FLAG:= N\n\nINCLUDE   += \nLIB       += \n\n#-----------------------------------------------------------------------\ninclude /home/tarsproto/Test/TarsStressServer/TarsStressServer.mk\ninclude /usr/local/tars/cpp/makefile/makefile.tars\n\n#-----------------------------------------------------------------------\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressClient/teststress.sh",
    "content": "#!/bin/bash\n\nfunction get_time()\n{\n    start=$1\n    end=$2\n\n    start_s=`echo $start | cut -d '.' -f 1`\n    start_ns=`echo $start | cut -d '.' -f 2`\n    end_s=`echo $end | cut -d '.' -f 1`\n    end_ns=`echo $end | cut -d '.' -f 2`\n\n    time_ms=$(( (10#$end_s-10#$start_s)*1000 + (10#$end_ns/1000000 - 10#$start_ns/1000000) ))\n    #time_ms=`expr $time_micro/1000  | bc `\n\n    echo \"total time $time_ms ms\"\n}\n\nif [[ $# -lt 3 ]];then\n  echo \"Usage: $0 [ProcessNum] [ThreadNum] [size]\"\n  exit 1\nfi\n\nbegin_time=$(date +%s.%N)\n#ct=1500000\nct=1500000\n\nfor((i=1; i<=$1; i++)); do {\n   ./TarsStressClient $2 $ct $3\n} & done\nwait\n\nend_time=$(date +%s.%N)\nget_time $begin_time $end_time\n\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressServer/Stress.tars",
    "content": "/**\n * Tencent is pleased to support the open source community by making Tars available.\n *\n * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use this file except \n * in compliance with the License. You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software distributed \n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR \n * CONDITIONS OF ANY KIND, either express or implied. See the License for the \n * specific language governing permissions and limitations under the License.\n */\n\nmodule Test\n{\n\ninterface Stress\n{\n    int test();  \n    int testStr(string sIn, out string sOut);\n};\n\n}; \n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressServer/StressImp.cpp",
    "content": "/**\n * Tencent is pleased to support the open source community by making Tars available.\n *\n * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use this file except \n * in compliance with the License. You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software distributed \n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR \n * CONDITIONS OF ANY KIND, either express or implied. See the License for the \n * specific language governing permissions and limitations under the License.\n */\n\n#include \"StressImp.h\"\n#include \"servant/Application.h\"\n#include \"TarsStressServer.h\"\n\nusing namespace std;\n\n//////////////////////////////////////////////////////\nvoid StressImp::initialize()\n{\n    //initialize servant here:\n    //...\n}\n\n//////////////////////////////////////////////////////\nvoid StressImp::destroy()\n{\n    //destroy servant here:\n    //...\n}\n\nint StressImp::test(tars::TarsCurrentPtr current) \n{ \n\n    return 0;\n}\n\n\ntars::Int32 StressImp::testStr(const std::string& in, std::string &out, tars::TarsCurrentPtr current)\n{\n    out = in;\n\n    ++_num;\n\n    if(_num == 100000)\n    {\n        TLOGDEBUG(\"pthread id:\"<<gettid()<<\"|time(ms):\"<<TC_TimeProvider::getInstance()->getNowMs()-_time<<endl);\n        _time=TC_TimeProvider::getInstance()->getNowMs();\n        _num=0;\n    }\n\n    return 0;\n}\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressServer/StressImp.h",
    "content": "/**\n * Tencent is pleased to support the open source community by making Tars available.\n *\n * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use this file except \n * in compliance with the License. You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software distributed \n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR \n * CONDITIONS OF ANY KIND, either express or implied. See the License for the \n * specific language governing permissions and limitations under the License.\n */\n\n#ifndef _StressImp_H_\n#define _StressImp_H_\n\n#include \"servant/Application.h\"\n#include \"Stress.h\"\n#include <sys/syscall.h>\n\n#define gettid() syscall(__NR_gettid)\n/**\n *\n *\n */\nclass StressImp : public Test::Stress\n{\npublic:\n    /**\n     *\n     */\n    virtual ~StressImp() {}\n\n    /**\n     *\n     */\n    virtual void initialize();\n\n    /**\n     *\n     */\n    virtual void destroy();\n\n    /**\n     *\n     */\n    virtual int test(tars::TarsCurrentPtr current);\n\n\n    tars::Int32 testStr(const std::string& sIn, std::string &sOut, tars::TarsCurrentPtr current);\nprivate:\n    int     _num;\n    int64_t _time;\n};\n/////////////////////////////////////////////////////\n#endif\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressServer/TarsStressServer.cpp",
    "content": "/**\n * Tencent is pleased to support the open source community by making Tars available.\n *\n * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use this file except \n * in compliance with the License. You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software distributed \n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR \n * CONDITIONS OF ANY KIND, either express or implied. See the License for the \n * specific language governing permissions and limitations under the License.\n */\n\n#include \"TarsStressServer.h\"\n#include \"StressImp.h\"\n\nusing namespace std;\n\nTarsStressServer g_app;\n\n/////////////////////////////////////////////////////////////////\nvoid TarsStressServer::initialize()\n{\n    //initialize application here:\n    //...\n\n    addServant<StressImp>(ServerConfig::Application + \".\" + ServerConfig::ServerName + \".StressObj\");\n}\n/////////////////////////////////////////////////////////////////\nvoid TarsStressServer::destroyApp()\n{\n    //destroy application here:\n    //...\n}\n/////////////////////////////////////////////////////////////////\n\nint main(int argc, char* argv[])\n{\n    try\n    {\n        g_app.main(argc, argv);\n        g_app.waitForShutdown();\n    }\n    catch (std::exception& e)\n    {\n        cerr << \"std::exception:\" << e.what() << std::endl;\n    }\n    catch (...)\n    {\n        cerr << \"unknown exception.\" << std::endl;\n    }\n    return -1;\n}\n/////////////////////////////////////////////////////////////////\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressServer/TarsStressServer.h",
    "content": "/**\n * Tencent is pleased to support the open source community by making Tars available.\n *\n * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use this file except \n * in compliance with the License. You may obtain a copy of the License at\n *\n * https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software distributed \n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR \n * CONDITIONS OF ANY KIND, either express or implied. See the License for the \n * specific language governing permissions and limitations under the License.\n */\n\n#ifndef _TarsStressServer_H_\n#define _TarsStressServer_H_\n\n#include <iostream>\n#include \"servant/Application.h\"\n\nusing namespace tars;\n\n/**\n *\n **/\nclass TarsStressServer : public Application\n{\npublic:\n    /**\n     *\n     **/\n    virtual ~TarsStressServer() {};\n\n    /**\n     *\n     **/\n    virtual void initialize();\n\n    /**\n     *\n     **/\n    virtual void destroyApp();\n\nprotected:\n\n};\n\nextern TarsStressServer g_app;\n\n////////////////////////////////////////////\n#endif\n"
  },
  {
    "path": "PerfTestSoft/StressBenchmark/TarsStressServer/makefile",
    "content": "\n#-----------------------------------------------------------------------\n\nAPP       := Test\nTARGET    := TarsStressServer\nCONFIG    := \nSTRIP_FLAG:= N\nTARS2CPP_FLAG:= \n\nINCLUDE   += \nLIB       += \n\n#-----------------------------------------------------------------------\n\ninclude /usr/local/tars/cpp/makefile/makefile.tars\n#-----------------------------------------------------------------------\n"
  },
  {
    "path": "PerfTestSoft/introduction.md",
    "content": "# Table of contents\n> * [1.Description](#main-chapter-1)\n> * [2.Framework Environment Setup](#main-chapter-2)\n> * [3.Server Side Test Software](#main-chapter-3)\n> * [4.Client Side Test Software](#main-chapter-4)\n> * [5.Note Well](#main-chapter-5)\n\n# 1. <a id=\"main-chapter-1\"></a> Description\n-  This folder is used to store the software for Tars performance Test.\n-  The test software consists of the client software and the server software.\n-  The Tars framework should be set up successfully prior to run the performance test software.\n\n\n# 2. <a id=\"main-chapter-2\"></a> Tars Framework Environment Setup\n-  In order to run the performance test, Tars framework is a must.\n-  You can setup the framework via script or do it step-by-step.\n-  Refer to the following link:\n-  https://github.com/TarsCloud/Tars/tree/master/shellDeploy\n-  https://github.com/TarsCloud/Tars#installation\n\n\n# 3. <a id=\"main-chapter-3\"></a> Server Side Test Software \n-  For the server side, \n\n\n# 4. <a id=\"main-chapter-4\"></a> Client Side Test Software\n-  For the client side, \n\n\n\n# 5. <a id=\"main-chapter-5\"></a> Note Well\n-  More informations you should pay special attention to.\n"
  },
  {
    "path": "README.md",
    "content": "\n\n# TARS - A Linux Foundation Project\n\n- [TARS Foundation Official Website](https://tarscloud.org/foundation/index)\n- [TARS Project Official Website](http://tarscloud.org/)\n- WeChat Offical Account: TarsCloud\n- QQ Group: 733605310, 579079160(Full), 669339903(Full)\n- Twitter: [@TarsCloud](https://twitter.com/TarsCloud)\n- [Mailing List](https://groups.google.com/g/tars-foundation-information)\n- [Contacts](https://tarscloud.org/about/contacts)\n\n## What is TARS?\n\nTARS is a Linux Foundation project. It is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.\n\nTars, aka TAF(Total Application Framework), has been used in Tencent since 2008. It supports C++, Java, Nodejs and PHP for now. This framework offers a set of solution for development, maintenance and testing, which making development, deployment and testing service efficiently.\nIt integrated extensible protocol for encoding/decoding, high-performance RPC communication framework, name service, monitor, statistics and configuration. You can use it to develop your reliable distributed application based on microservice fast, and reach fully efficient service management.\n\nNowadays it's used by hundreds of bussiness in Tencent, services that developed base on TAF run on 16 thousands of machines.\n\nSee the detailed introduction [SUMMARY.md](https://tarscloud.github.io/TarsDocs_en/).\n\n## Supported platforms\nFor now it supports OS as below:\n\n- Linux\n- Mac(>=2.1.0 support)\n- Windows (>= Windows 7)\n\n## Supported languages\n\nFor now it supports following languages:\n\n- C++\n- Java\n- Nodejs\n- PHP\n- Go\n \n## Version Management\n \nTars is composed of many modules, scattered in many warehouses, and the basic framework version and language version can develop independently. In view of this, from version 2.1.0, the Framework version tag is printed on the tarsframework warehouse, no longer reflected in the tars warehouse\n\nIn addition, each component will have its own version. When there is a version dependency specification, each component will have its own version\n\n## Installation \n\n1. If you are new to Tars, please read documentation [installation](https://tarscloud.github.io/TarsDocs_en/installation).\n2. First deploy, please read documentation [source](https://tarscloud.github.io/TarsDocs_en/installation/source.html).\n3. Install by docker, detail information: [docker](https://tarscloud.github.io/TarsDocs_en/installation/docker.html)。\n\n## Submodule\n\nDirectory         |Features\n------------------|----------------\nframework         |Source code implementation of C++ language framework basic service\ncpp               |C++ language framework rpc source code implementation\njava              |java language framework rpc source code implementation\ngo                |go language framework rpc source code implementation\nnodejs            |nodejs language framework rpc source code implementation\nphp               |php language framework rpc source code implementation\ntup               |source code implementation of tup group protocol in each language\nweb               |manage tars web source implementation\n\n## Developer's documentation\n\nSee [docs](https://github.com/TarsCloud/TarsDocs_en).\n\n## License\n\nThe open-source protocol Tars used is BSD-3-Clause, see [LICENSE.md](https://github.com/TarsCloud/TarsDocs_en/blob/master/LICENSE).\n\n## Chinese Version\n[Read Chinese Version](README.zh.md)\n\n"
  },
  {
    "path": "README.zh.md",
    "content": "[Click me switch to English version](README.md)\n\n# Readme.md\n\n# Tars\n\n- Twitter: [@TarsCloud](https://twitter.com/TarsCloud)\n- [Mailing List](https://groups.google.com/g/tars-foundation-information)\n- [官网](http://tarscloud.org/)\n- [新闻](https://tarscloud.org/feed/newsroom)\n- qq技术交流群群：733605310, 579079160(满), 669339903(满)\n- 微信公众号: TarsCloud\n- [更多联系方式请点击](https://tarscloud.org/about/contacts)\n\n## 简介\n\nTars这个名字取自于电影\"星际穿越\"中的机器人，它是基于名字服务使用Tars协议的高性能RPC开发框架，配套一体化的运营管理平台，并通过伸缩调度，实现运维半托管服务。\n\nTars是腾讯从2008年到今天一直在使用的后台逻辑层的统一应用框架TAF（Total Application Framework），目前支持C++,Java,PHP,Nodejs,Go语言。该框架为用户提供了涉及到开发、运维、以及测试的一整套解决方案，帮助一个产品或者服务快速开发、部署、测试、上线。 它集可扩展协议编解码、高性能RPC通信框架、名字路由与发现、发布监控、日志统计、配置管理等于一体，通过它可以快速用微服务的方式构建自己的稳定可靠的分布式应用，并实现完整有效的服务治理。\n\n目前该框架在腾讯内部，各大核心业务都在使用，颇受欢迎，基于该框架部署运行的服务节点规模达到上万个。\n\nTars详细介绍参见 [目录](https://tarscloud.github.io/TarsDocs/SUMMARY.html)。\n\n## 安装 \n\n1. 如果你是新手安装Tars, 请务必阅读部署的整体的说明 [installation](https://tarscloud.github.io/TarsDocs/installation)\n2. 如果你是第一次部署, 建议采用源码部署熟悉系统 [source](https://tarscloud.github.io/TarsDocs/installation/source.html)\n3. 如果你比较熟悉, 可以采用docker部署 [docker](https://tarscloud.github.io/TarsDocs/installation/docker.html)\n\n\n### 支持平台\n\n目前运行的操作系统平台如下：\n\n* Linux\n* Mac(>=2.1.0 support)\n\n### 支持语言\n\n目前支持的开发语言如下：\n\n* C++\n* Java\n* Nodejs\n* PHP\n* Go\n\n### 版本管理\n\nTars由多种模块组成, 分散在多个仓库中, 并且基础框架版本和语言版本可以独立发展, 鉴于此, 从2.1.0版本开始, 框架的版本TAG打在TarsFramework仓库上, 不再体现在Tars这个仓库上.\n\n另外各个组件会有自己独立的版本, 当有版本依赖说明时, 各组件会独立说明.\n\n\n### License\n\nTars的开源协议为BSD-3-Clause，详情参见 [LICENSE](https://github.com/TarsCloud/TarsDocs/blob/master/LICENSE)。\n\n### 参与贡献\n\n如果你有任何想法，别犹豫，立即提 Issues 或 Pull Requests，欢迎所有人参与到 TARS 的开源建设中。\n提PR前请先确认签署了 [CLA](https://tarscloud.github.io/TarsDocs/cla.html) 哦。\n\n\n\n"
  },
  {
    "path": "tag.sh",
    "content": "# Copyright (c) 2020\n# Linux Foundation Projects\n#       Link: https://www.linuxfoundation.org/projects/\n# TARS Foundation Projects\n#       Link: https://github.com/TarsCloud\n# All rights reserved.\n\n#!/bin/bash\n\n#update & merge code tools\n\nfunction show()\n{\n    branch=$1\n\n    echo \"tars:\"; git branch -a | grep \"*\";\n    cd framework; echo \"framework:\"; git branch -a | grep \"*\"; \n    cd tarscpp; echo \"tarscpp:\"; git branch -a | grep \"*\"; \n    cd servant/protocol; echo \"protocol:\"; git branch -a | grep \"*\"; \n    cd ../../../..\n}\n\n\nfunction update()\n{\n    branch=$1\n\n    git submodule update --remote --recursive\n\n    cd framework; git checkout $branch; git pull --rebase; \n    cd tarscpp; git checkout $branch; git pull --rebase;\n    cd servant/protocol; git checkout $branch; git pull --rebase;\n    cd ../../../..\n}\n\nfunction merge()\n{\n    version1=$1\n    version2=$2\n\n    cd framework; git checkout $version2; git pull $version2 --rebase; git checkout $version1; git merge $version2;\n    cd tarscpp; git checkout $version2; git pull $version2 --rebase; git checkout $version1; git merge  $version2;\n    cd servant/protocol; git checkout $version2; git pull $version2 --rebase; git checkout $version1; git merge $version2;\n    cd ../../../..\n}\n\nfunction branch()\n{\n    version1=$1\n    cd framework/tarscpp/servant/protocol; git checkout $version1;\n    cd ../..; git checkout $version1;\n    cd ..; git checkout $version1;\n    cd ..; git checkout $version1; \n}\n\nfunction commit()\n{\n    version1=$1\n    cd framework/tarscpp/servant/protocol; git checkout $version1; git commit -a -m \"update merge\";\n    cd ../..; git checkout $version1; git commit -a -m \"update protocol\";\n    cd ..; git checkout $version1; git commit -a -m \"update tarscpp\";\n    cd ..; git checkout $version1; git commit -a -m \"update framework\";\n}\n\nfunction push()\n{\n    version1=$1\n    cd framework; git checkout $version1; git push origin $version1;\n    cd tarscpp; git checkout $version1; git push origin $version1;\n    cd servant/protocol; git checkout $version1; git push origin $version1;\n    cd ../../../..;git checkout $version1; git push origin $version1;\n}\n\nversion=$2\ncase $1 in\n    \"show\")\n        show\n        ;;\n    \"branch\")\n        branch $2\n        show\n        ;;\n    \"update\")\n        update $2\n        ;;\n    \"commit\")\n        commit $2\n        ;;\n    \"push\")\n        push $2\n        ;;\n    \"merge-master\")\n        merge master release/2.4\n        ;;\n    \"merge-release\")\n        merge release/2.4 master \n        ;;\n    \"all\")\n        show\n        update release/2.4\n        merge-release\n        commit release/2.4    \n        push release/2.4\n        update master\n        merge-master\n        commit master\n        push master\n        ;;\n    *)\n        echo \"$0 show, show all branch\"\n        echo \"$0 branch [branch], checkout to branch\"\n        echo \"$0 update [branch], update branch to new\"\n        echo \"$0 commit [branch], commit branch\"\n        echo \"$0 push [branch], push branch\"\n        echo \"$0 merge-master], checkout master and merge release to master\"\n        echo \"$0 merge-release], checkout relase and merge master to release\"\n        echo \"$0 all, do all\"\n        ;;\nesac\n\n"
  },
  {
    "path": "tars-deploy-framework.sh",
    "content": "#!/bin/bash\n\nif (( $# < 2 ))\nthen\n    echo $#\n    echo \"$0 tag push(false/true)\"\n    exit 1\nfi\n\ntag=$1\npush=$2\n\nif [ \"$push\" == \"true\" ]; then\n\tpush=\"true\"\nelse\n\tpush=\"false\"\nfi\n\n# tarsTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always)\n# cd framework && frameworkTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd ..\n# cd web && webTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd ..\n\ntarsTag=$tag\ncd framework && frameworkTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd ..\ncd web && webTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd ..\n\necho \"starting tars:${tarsTag} framework:$frameworkTag web:$webTag deploy\"\n\ncd docker/framework\n./build-docker.sh $frameworkTag $webTag ${tarsTag} ${push}\n"
  },
  {
    "path": "tars-deploy-tars.sh",
    "content": "#!/bin/bash\n\nif (( $# < 2 ))\nthen\n    echo $#\n    echo \"$0 tag push(false/true)\"\n    exit 1\nfi\n\ntag=$1\npush=$2\n\nif [ \"$push\" == \"true\" ]; then\n\tpush=\"true\"\nelse\n\tpush=\"false\"\nfi\n\n# tarsTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always)\n# cd framework && frameworkTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd ..\n# cd web && webTag=$(git describe --tags $(git rev-list --tags --max-count=1) --abbrev=0 --always) && cd ..\n\ntarsTag=$tag\ncd framework && frameworkTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd ..\ncd web && webTag=$(git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}') && cd ..\n\necho \"starting tars:${tarsTag} framework:$frameworkTag web:$webTag deploy\"\n\ncd docker/tars\n./build-docker.sh $frameworkTag $webTag ${tarsTag} ${push}\n"
  },
  {
    "path": "tars-latest-deploy-framework.sh",
    "content": "#!/bin/bash\n\nif (( $# < 1 ))\nthen\n    echo $#\n    echo \"$0 push(false/true)\"\n    exit 1\nfi\n\npush=$1\n\nif [ \"$push\" == \"true\" ]; then\n\tpush=\"true\"\nelse\n\tpush=\"false\"\nfi\n\ncd docker/framework\n./build-docker.sh master master latest ${push}\n"
  },
  {
    "path": "tars-latest-deploy-tars.sh",
    "content": "#!/bin/bash\n\nif (( $# < 1 ))\nthen\n    echo $#\n    echo \"$0 push(false/true)\"\n    exit 1\nfi\n\npush=$1\n\nif [ \"$push\" == \"true\" ]; then\n\tpush=\"true\"\nelse\n\tpush=\"false\"\nfi\n\ncd docker/tars\n./build-docker.sh master master latest ${push}\n"
  }
]