Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
314deb61
Commit
314deb61
authored
Aug 30, 2009
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build system for perf/C and perf/C++
parent
6c366739
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
86 additions
and
38 deletions
+86
-38
Makefile.am
Makefile.am
+2
-2
configure.in
configure.in
+2
-1
zmq.h
include/zmq.h
+12
-12
Makefile.am
perf/Makefile.am
+2
-0
Makefile.am
perf/c/Makefile.am
+20
-0
local_lat.c
perf/c/local_lat.c
+1
-1
local_thr.c
perf/c/local_thr.c
+10
-9
remote_lat.c
perf/c/remote_lat.c
+3
-4
remote_thr.c
perf/c/remote_thr.c
+2
-2
Makefile.am
perf/cpp/Makefile.am
+20
-0
local_lat.cpp
perf/cpp/local_lat.cpp
+2
-1
local_thr.cpp
perf/cpp/local_thr.cpp
+6
-4
remote_lat.cpp
perf/cpp/remote_lat.cpp
+2
-1
remote_thr.cpp
perf/cpp/remote_thr.cpp
+2
-1
No files found.
Makefile.am
View file @
314deb61
...
@@ -8,5 +8,5 @@ if BUILD_RUBY
...
@@ -8,5 +8,5 @@ if BUILD_RUBY
DIR_R
=
ruby
DIR_R
=
ruby
endif
endif
SUBDIRS
=
src
$(DIR_P)
$(DIR_R)
SUBDIRS
=
src
perf
$(DIR_P)
$(DIR_R)
DIST_SUBDIRS
=
src
$(DIR_P)
$(DIR_R)
DIST_SUBDIRS
=
src
perf
$(DIR_P)
$(DIR_R)
configure.in
View file @
314deb61
...
@@ -275,7 +275,8 @@ AC_FUNC_MALLOC
...
@@ -275,7 +275,8 @@ AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
AC_OUTPUT(Makefile src/Makefile python/Makefile python/setup.py ruby/Makefile)
AC_OUTPUT(Makefile src/Makefile python/Makefile python/setup.py ruby/Makefile \
perf/Makefile perf/c/Makefile perf/cpp/Makefile)
AC_MSG_RESULT([])
AC_MSG_RESULT([])
AC_MSG_RESULT([ ******************************************************** ])
AC_MSG_RESULT([ ******************************************************** ])
...
...
include/zmq.h
View file @
314deb61
...
@@ -103,41 +103,41 @@ struct zmq_msg_t
...
@@ -103,41 +103,41 @@ struct zmq_msg_t
};
};
// Initialise an empty message (zero bytes long).
// Initialise an empty message (zero bytes long).
ZMQ_EXPORT
int
zmq_msg_init
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
int
zmq_msg_init
(
struct
zmq_msg_t
*
msg
);
// Initialise a message 'size' bytes long.
// Initialise a message 'size' bytes long.
//
//
// Errors: ENOMEM - the size is too large to allocate.
// Errors: ENOMEM - the size is too large to allocate.
ZMQ_EXPORT
int
zmq_msg_init_size
(
zmq_msg_t
*
msg
,
size_t
size
);
ZMQ_EXPORT
int
zmq_msg_init_size
(
struct
zmq_msg_t
*
msg
,
size_t
size
);
// Initialise a message from an existing buffer. Message isn't copied,
// Initialise a message from an existing buffer. Message isn't copied,
// instead 0SOCKETS infrastructure take ownership of the buffer and call
// instead 0SOCKETS infrastructure take ownership of the buffer and call
// deallocation functio (ffn) once it's not needed anymore.
// deallocation functio (ffn) once it's not needed anymore.
ZMQ_EXPORT
int
zmq_msg_init_data
(
zmq_msg_t
*
msg
,
void
*
data
,
size_t
size
,
ZMQ_EXPORT
int
zmq_msg_init_data
(
struct
zmq_msg_t
*
msg
,
void
*
data
,
zmq_free_fn
*
ffn
);
size_t
size
,
zmq_free_fn
*
ffn
);
// Deallocate the message.
// Deallocate the message.
ZMQ_EXPORT
int
zmq_msg_close
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
int
zmq_msg_close
(
struct
zmq_msg_t
*
msg
);
// Move the content of the message from 'src' to 'dest'. The content isn't
// Move the content of the message from 'src' to 'dest'. The content isn't
// copied, just moved. 'src' is an empty message after the call. Original
// copied, just moved. 'src' is an empty message after the call. Original
// content of 'dest' message is deallocated.
// content of 'dest' message is deallocated.
ZMQ_EXPORT
int
zmq_msg_move
(
zmq_msg_t
*
dest
,
zmq_msg_t
*
src
);
ZMQ_EXPORT
int
zmq_msg_move
(
struct
zmq_msg_t
*
dest
,
struct
zmq_msg_t
*
src
);
// Copy the 'src' message to 'dest'. The content isn't copied, instead
// Copy the 'src' message to 'dest'. The content isn't copied, instead
// reference count is increased. Don't modify the message data after the
// reference count is increased. Don't modify the message data after the
// call as they are shared between two messages. Original content of 'dest'
// call as they are shared between two messages. Original content of 'dest'
// message is deallocated.
// message is deallocated.
ZMQ_EXPORT
int
zmq_msg_copy
(
zmq_msg_t
*
dest
,
zmq_msg_t
*
src
);
ZMQ_EXPORT
int
zmq_msg_copy
(
struct
zmq_msg_t
*
dest
,
struct
zmq_msg_t
*
src
);
// Returns pointer to message data.
// Returns pointer to message data.
ZMQ_EXPORT
void
*
zmq_msg_data
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
void
*
zmq_msg_data
(
struct
zmq_msg_t
*
msg
);
// Return size of message data (in bytes).
// Return size of message data (in bytes).
ZMQ_EXPORT
size_t
zmq_msg_size
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
size_t
zmq_msg_size
(
struct
zmq_msg_t
*
msg
);
// Returns type of the message.
// Returns type of the message.
ZMQ_EXPORT
int
zmq_msg_type
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
int
zmq_msg_type
(
struct
zmq_msg_t
*
msg
);
// Initialise 0SOCKETS context. 'app_threads' specifies maximal number
// Initialise 0SOCKETS context. 'app_threads' specifies maximal number
// of application threads that can have open sockets at the same time.
// of application threads that can have open sockets at the same time.
...
@@ -182,7 +182,7 @@ ZMQ_EXPORT int zmq_connect (void *s, const char *addr);
...
@@ -182,7 +182,7 @@ ZMQ_EXPORT int zmq_connect (void *s, const char *addr);
// Errors: EAGAIN - message cannot be sent at the moment (applies only to
// Errors: EAGAIN - message cannot be sent at the moment (applies only to
// non-blocking send).
// non-blocking send).
// ENOTSUP - function isn't supported by particular socket type.
// ENOTSUP - function isn't supported by particular socket type.
ZMQ_EXPORT
int
zmq_send
(
void
*
s
,
zmq_msg_t
*
msg
,
int
flags
);
ZMQ_EXPORT
int
zmq_send
(
void
*
s
,
struct
zmq_msg_t
*
msg
,
int
flags
);
// Flush the messages that were send using ZMQ_NOFLUSH flag down the stream.
// Flush the messages that were send using ZMQ_NOFLUSH flag down the stream.
//
//
...
@@ -196,7 +196,7 @@ ZMQ_EXPORT int zmq_flush (void *s);
...
@@ -196,7 +196,7 @@ ZMQ_EXPORT int zmq_flush (void *s);
// Errors: EAGAIN - message cannot be received at the moment (applies only to
// Errors: EAGAIN - message cannot be received at the moment (applies only to
// non-blocking receive).
// non-blocking receive).
// ENOTSUP - function isn't supported by particular socket type.
// ENOTSUP - function isn't supported by particular socket type.
ZMQ_EXPORT
int
zmq_recv
(
void
*
s
,
zmq_msg_t
*
msg
,
int
flags
);
ZMQ_EXPORT
int
zmq_recv
(
void
*
s
,
struct
zmq_msg_t
*
msg
,
int
flags
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
perf/Makefile.am
0 → 100644
View file @
314deb61
SUBDIRS
=
c cpp
DIST_SUBDIRS
=
c cpp
perf/c/Makefile.am
0 → 100644
View file @
314deb61
INCLUDES
=
-I
$(top_builddir)
/include
bin_PROGRAMS
=
local_lat remote_lat local_thr remote_thr
local_lat_LDADD
=
$(top_builddir)
/src/libzmq.la
local_lat_SOURCES
=
local_lat.c
local_lat_CXXFLAGS
=
-Wall
-pedantic
-Werror
remote_lat_LDADD
=
$(top_builddir)
/src/libzmq.la
remote_lat_SOURCES
=
remote_lat.c
remote_lat_CXXFLAGS
=
-Wall
-pedantic
-Werror
local_thr_LDADD
=
$(top_builddir)
/src/libzmq.la
local_thr_SOURCES
=
local_thr.c
local_thr_CXXFLAGS
=
-Wall
-pedantic
-Werror
remote_thr_LDADD
=
$(top_builddir)
/src/libzmq.la
remote_thr_SOURCES
=
remote_thr.c
remote_thr_CXXFLAGS
=
-Wall
-pedantic
-Werror
perf/c/local_lat.c
View file @
314deb61
...
@@ -32,7 +32,7 @@ int main (int argc, char *argv [])
...
@@ -32,7 +32,7 @@ int main (int argc, char *argv [])
void
*
s
;
void
*
s
;
int
rc
;
int
rc
;
int
i
;
int
i
;
zmq_msg_t
msg
;
struct
zmq_msg_t
msg
;
if
(
argc
!=
4
)
{
if
(
argc
!=
4
)
{
printf
(
"usage: local_lat <bind-to> <roundtrip-count> "
printf
(
"usage: local_lat <bind-to> <roundtrip-count> "
...
...
perf/c/local_thr.c
View file @
314deb61
...
@@ -17,10 +17,11 @@
...
@@ -17,10 +17,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <zmq.h
pp
>
#include <zmq.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <assert.h>
#include <assert.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/time.h>
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
...
@@ -32,9 +33,11 @@ int main (int argc, char *argv [])
...
@@ -32,9 +33,11 @@ int main (int argc, char *argv [])
void
*
s
;
void
*
s
;
int
rc
;
int
rc
;
int
i
;
int
i
;
zmq_msg_t
msg
;
struct
zmq_msg_t
msg
;
long
long
elapsed
;
struct
timeval
start
;
long
long
throughput
;
struct
timeval
end
;
uint64_t
elapsed
;
uint64_t
throughput
;
if
(
argc
!=
4
)
{
if
(
argc
!=
4
)
{
printf
(
"usage: local_thr <bind-to> <message-count> "
printf
(
"usage: local_thr <bind-to> <message-count> "
...
@@ -61,7 +64,6 @@ int main (int argc, char *argv [])
...
@@ -61,7 +64,6 @@ int main (int argc, char *argv [])
assert
(
rc
==
0
);
assert
(
rc
==
0
);
assert
(
zmq_msg_size
(
&
msg
)
==
message_size
);
assert
(
zmq_msg_size
(
&
msg
)
==
message_size
);
timeval
start
;
rc
=
gettimeofday
(
&
start
,
NULL
);
rc
=
gettimeofday
(
&
start
,
NULL
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
...
@@ -71,17 +73,16 @@ int main (int argc, char *argv [])
...
@@ -71,17 +73,16 @@ int main (int argc, char *argv [])
assert
(
zmq_msg_size
(
&
msg
)
==
message_size
);
assert
(
zmq_msg_size
(
&
msg
)
==
message_size
);
}
}
timeval
end
;
rc
=
gettimeofday
(
&
end
,
NULL
);
rc
=
gettimeofday
(
&
end
,
NULL
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
end
.
tv_sec
-=
start
.
tv_sec
;
end
.
tv_sec
-=
start
.
tv_sec
;
start
.
tv_sec
=
0
;
start
.
tv_sec
=
0
;
elapsed
=
(
end
.
tv_sec
*
1000000
+
end
.
tv_usec
)
-
elapsed
=
(
(
uint64_t
)
end
.
tv_sec
*
1000000
+
end
.
tv_usec
)
-
(
start
.
tv_sec
*
1000000
+
start
.
tv_usec
);
(
(
uint64_t
)
start
.
tv_sec
*
1000000
+
start
.
tv_usec
);
throughput
=
(
long
long
)
message_count
*
1000000
/
elapsed
;
throughput
=
(
uint64_t
)
message_count
*
1000000
/
elapsed
;
printf
(
"message size: %d [B]
\n
"
,
(
int
)
message_size
);
printf
(
"message size: %d [B]
\n
"
,
(
int
)
message_size
);
printf
(
"message count: %d
\n
"
,
(
int
)
message_count
);
printf
(
"message count: %d
\n
"
,
(
int
)
message_count
);
...
...
perf/c/remote_lat.c
View file @
314deb61
...
@@ -32,7 +32,9 @@ int main (int argc, char *argv [])
...
@@ -32,7 +32,9 @@ int main (int argc, char *argv [])
void
*
s
;
void
*
s
;
int
rc
;
int
rc
;
int
i
;
int
i
;
zmq_msg_t
msg
;
struct
zmq_msg_t
msg
;
struct
timeval
start
;
struct
timeval
end
;
double
elapsed
;
double
elapsed
;
double
latency
;
double
latency
;
...
@@ -54,7 +56,6 @@ int main (int argc, char *argv [])
...
@@ -54,7 +56,6 @@ int main (int argc, char *argv [])
rc
=
zmq_connect
(
s
,
connect_to
);
rc
=
zmq_connect
(
s
,
connect_to
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
timeval
start
;
rc
=
gettimeofday
(
&
start
,
NULL
);
rc
=
gettimeofday
(
&
start
,
NULL
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
...
@@ -70,8 +71,6 @@ int main (int argc, char *argv [])
...
@@ -70,8 +71,6 @@ int main (int argc, char *argv [])
assert
(
rc
==
0
);
assert
(
rc
==
0
);
}
}
timeval
end
;
rc
=
gettimeofday
(
&
end
,
NULL
);
rc
=
gettimeofday
(
&
end
,
NULL
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
...
...
perf/c/remote_thr.c
View file @
314deb61
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <zmq.h
pp
>
#include <zmq.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
...
@@ -32,7 +32,7 @@ int main (int argc, char *argv [])
...
@@ -32,7 +32,7 @@ int main (int argc, char *argv [])
void
*
s
;
void
*
s
;
int
rc
;
int
rc
;
int
i
;
int
i
;
zmq_msg_t
msg
;
struct
zmq_msg_t
msg
;
if
(
argc
!=
4
)
{
if
(
argc
!=
4
)
{
printf
(
"usage: remote_thr <connect-to> <message-count> "
printf
(
"usage: remote_thr <connect-to> <message-count> "
...
...
perf/cpp/Makefile.am
0 → 100644
View file @
314deb61
INCLUDES
=
-I
$(top_builddir)
/include
bin_PROGRAMS
=
local_lat remote_lat local_thr remote_thr
local_lat_LDADD
=
$(top_builddir)
/src/libzmq.la
local_lat_SOURCES
=
local_lat.cpp
local_lat_CXXFLAGS
=
-Wall
-pedantic
-Werror
remote_lat_LDADD
=
$(top_builddir)
/src/libzmq.la
remote_lat_SOURCES
=
remote_lat.cpp
remote_lat_CXXFLAGS
=
-Wall
-pedantic
-Werror
local_thr_LDADD
=
$(top_builddir)
/src/libzmq.la
local_thr_SOURCES
=
local_thr.cpp
local_thr_CXXFLAGS
=
-Wall
-pedantic
-Werror
remote_thr_LDADD
=
$(top_builddir)
/src/libzmq.la
remote_thr_SOURCES
=
remote_thr.cpp
remote_thr_CXXFLAGS
=
-Wall
-pedantic
-Werror
perf/cpp/local_lat.cpp
View file @
314deb61
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include <assert.h>
#include <assert.h>
#include <stddef.h>
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
...
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
}
}
const
char
*
bind_to
=
argv
[
1
];
const
char
*
bind_to
=
argv
[
1
];
int
roundtrip_count
=
atoi
(
argv
[
2
]);
int
roundtrip_count
=
atoi
(
argv
[
2
]);
int
message_size
=
atoi
(
argv
[
3
]);
size_t
message_size
=
(
size_t
)
atoi
(
argv
[
3
]);
zmq
::
context_t
ctx
(
1
,
1
);
zmq
::
context_t
ctx
(
1
,
1
);
...
...
perf/cpp/local_thr.cpp
View file @
314deb61
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <assert.h>
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/time.h>
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
...
@@ -32,7 +34,7 @@ int main (int argc, char *argv [])
...
@@ -32,7 +34,7 @@ int main (int argc, char *argv [])
}
}
const
char
*
bind_to
=
argv
[
1
];
const
char
*
bind_to
=
argv
[
1
];
int
message_count
=
atoi
(
argv
[
2
]);
int
message_count
=
atoi
(
argv
[
2
]);
int
message_size
=
atoi
(
argv
[
3
]);
size_t
message_size
=
(
size_t
)
atoi
(
argv
[
3
]);
zmq
::
context_t
ctx
(
1
,
1
);
zmq
::
context_t
ctx
(
1
,
1
);
...
@@ -59,10 +61,10 @@ int main (int argc, char *argv [])
...
@@ -59,10 +61,10 @@ int main (int argc, char *argv [])
end
.
tv_sec
-=
start
.
tv_sec
;
end
.
tv_sec
-=
start
.
tv_sec
;
start
.
tv_sec
=
0
;
start
.
tv_sec
=
0
;
long
long
elapsed
=
(
end
.
tv_sec
*
1000000
+
end
.
tv_usec
)
-
uint64_t
elapsed
=
((
uint64_t
)
end
.
tv_sec
*
1000000
+
end
.
tv_usec
)
-
(
start
.
tv_sec
*
1000000
+
start
.
tv_usec
);
(
(
uint64_t
)
start
.
tv_sec
*
1000000
+
start
.
tv_usec
);
long
long
throughput
=
(
long
long
)
message_count
*
1000000
/
elapsed
;
uint64_t
throughput
=
(
uint64_t
)
message_count
*
1000000
/
elapsed
;
printf
(
"message size: %d [B]
\n
"
,
(
int
)
message_size
);
printf
(
"message size: %d [B]
\n
"
,
(
int
)
message_size
);
printf
(
"message count: %d
\n
"
,
(
int
)
message_count
);
printf
(
"message count: %d
\n
"
,
(
int
)
message_count
);
...
...
perf/cpp/remote_lat.cpp
View file @
314deb61
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <assert.h>
#include <assert.h>
#include <stddef.h>
#include <sys/time.h>
#include <sys/time.h>
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
...
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
...
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
}
}
const
char
*
connect_to
=
argv
[
1
];
const
char
*
connect_to
=
argv
[
1
];
int
roundtrip_count
=
atoi
(
argv
[
2
]);
int
roundtrip_count
=
atoi
(
argv
[
2
]);
int
message_size
=
atoi
(
argv
[
3
]);
size_t
message_size
=
(
size_t
)
atoi
(
argv
[
3
]);
zmq
::
context_t
ctx
(
1
,
1
);
zmq
::
context_t
ctx
(
1
,
1
);
...
...
perf/cpp/remote_thr.cpp
View file @
314deb61
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include <assert.h>
#include <assert.h>
#include <stddef.h>
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
...
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
}
}
const
char
*
connect_to
=
argv
[
1
];
const
char
*
connect_to
=
argv
[
1
];
int
message_count
=
atoi
(
argv
[
2
]);
int
message_count
=
atoi
(
argv
[
2
]);
int
message_size
=
atoi
(
argv
[
3
]);
size_t
message_size
=
(
size_t
)
atoi
(
argv
[
3
]);
zmq
::
context_t
ctx
(
1
,
1
);
zmq
::
context_t
ctx
(
1
,
1
);
...
...
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