Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ademco_hb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
ademco_hb
Commits
60646b8f
Commit
60646b8f
authored
Aug 04, 2020
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9e8edbdb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
bench_client.cpp
examples/bench_client/bench_client.cpp
+7
-9
bench_client.vcxproj.user
examples/bench_client/bench_client.vcxproj.user
+1
-1
build.sh
examples/build.sh
+1
-1
No files found.
examples/bench_client/bench_client.cpp
View file @
60646b8f
/**
Ping Pong Client
*/
#ifndef _WIN32
#include <unistd.h>
#include <netinet/in.h>
...
...
@@ -267,6 +263,8 @@ event_base* init_thread(const sockaddr_in& sin, int session_start, int session_p
fprintf
(
stderr
,
"error starting connection
\n
"
);
exit
(
-
1
);
}
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
1
));
}
return
base
;
...
...
@@ -337,11 +335,11 @@ int main(int argc, char** argv)
std
::
vector
<
std
::
thread
>
threads
;
for
(
int
i
=
1
;
i
<
thread_count
;
i
++
)
{
auto
base
=
init_thread
(
sin
,
i
*
session_per_thread
,
session_per_thread
);
threads
.
push_back
(
std
::
thread
([](
event_base
*
base
)
{
threads
.
push_back
(
std
::
thread
([
&
sin
,
i
,
session_per_thread
]()
{
//printf("thread %lld created\n", gettid());
auto
base
=
init_thread
(
sin
,
i
*
session_per_thread
,
session_per_thread
);
event_base_dispatch
(
base
);
}
,
base
));
}));
}
auto
main_thread_base
=
init_thread
(
sin
,
0
,
session_per_thread
);
...
...
examples/bench_client/bench_client.vcxproj.user
View file @
60646b8f
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"Current"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<LocalDebuggerCommandArguments>
192.168.1.16
8 12345 10 1
0
</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>
192.168.1.16
6 12345 6 600 5
0
</LocalDebuggerCommandArguments>
<DebuggerFlavor>
WindowsLocalDebugger
</DebuggerFlavor>
</PropertyGroup>
</Project>
\ No newline at end of file
examples/build.sh
View file @
60646b8f
...
...
@@ -2,7 +2,7 @@
mkdir
-p
build
cd
build
opt
=
"-std=c++11 -O3"
opt
=
"-std=c++11 -O3
-g -gdwarf
"
g++
$opt
../bench/bench.cpp
-I
../../include
-o
bench
g++
$opt
../demo/demo.cpp
-I
../../include
-o
demo
g++
$opt
../server_demo/server_demo.cpp
-I
../../include
-lpthread
-o
server_demo
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment