Skip to content
Snippets Groups Projects
Commit 41ddee61 authored by Martin Gels's avatar Martin Gels
Browse files

Bug 1005: Added directory CS1_Tools to built for now the generator and

udp-copy.
parent 65fce22f
No related branches found
No related tags found
No related merge requests found
Showing
with 680 additions and 5 deletions
......@@ -27,6 +27,8 @@
3rdparty/sourceforge/dtemplatelib/tests/tests.res -text svneol=unset#unset
3rdparty/sourceforge/dtemplatelib/tests/tests_build_sh.opt -text svneol=unset#unset
3rdparty/sourceforge/log4cplus/log4cplus-1.0.2.tar.gz -text svneol=unset#unset
Appl/CEP/CS1/CS1_Tools/bootstrap -text
Appl/CEP/CS1/CS1_Tools/src/cexec-udp-copy -text
CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat -text svneol=unset#unset
CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 -text svneol=unset#unset
CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i -text svneol=unset#unset
......
pkginclude_HEADERS = Package__Version.h
lib_LTLIBRARIES = liblofar_impl.la
liblofar_impl_la_SOURCES = $(DOCHDRS) \
liblofar_impl_la_SOURCES = Package__Version.cc $(DOCHDRS) \
BeamletBuffer.h \
BeamletBuffer.cc \
BGL_Personality.h \
......@@ -36,4 +38,10 @@ install-exec-local:
uninstall-local:
rm lofar_impl.so
bin_PROGRAMS = versioncs1_ionproc
versioncs1_ionproc_SOURCES = versioncs1_ionproc.cc
versioncs1_ionproc_LDADD = liblofar_impl.la
versioncs1_ionproc_DEPENDENCIES = liblofar_impl.la $(LOFAR_DEPEND)
include $(top_srcdir)/Makefile.common
pkginclude_HEADERS = \
pkginclude_HEADERS = Package__Version.h \
BGL_Command.h \
BGL_Configuration.h \
BGL_Mapping.h \
......
lib_LTLIBRARIES = libcs1_interface.la
libcs1_interface_la_SOURCES = \
libcs1_interface_la_SOURCES = Package__Version.cc \
BGL_Configuration.cc \
BGL_Mapping.cc \
CS1_Parset.cc \
......@@ -12,4 +12,10 @@ libcs1_interface_la_SOURCES = \
configfilesdir = $(bindir)
bin_PROGRAMS = versioncs1_interface
versioncs1_interface_SOURCES = versioncs1_interface.cc
versioncs1_interface_LDADD = libcs1_interface.la
versioncs1_interface_DEPENDENCIES = libcs1_interface.la $(LOFAR_DEPEND)
include $(top_srcdir)/Makefile.common
pkginclude_HEADERS = Package__Version.h
noinst_HEADERS = \
AH_Storage.h \
WH_SubbandWriter.h \
......
lib_LTLIBRARIES = libcs1_storage.la
libcs1_storage_la_SOURCES = AH_Storage.cc \
libcs1_storage_la_SOURCES = Package__Version.cc AH_Storage.cc \
WH_SubbandWriter.cc \
ACCmain_Storage.cc \
MSWriter.cc \
MSWriterImpl.cc
bin_PROGRAMS = CS1_Storage
bin_PROGRAMS = versioncs1_storage CS1_Storage
CS1_Storage_SOURCES = CS1_Storage_main.cc
CS1_Storage_LDADD = libcs1_storage.la
......@@ -18,6 +18,10 @@ configfiles_DATA = CS1_Storage.machinefile \
typeStruct_TTeraFlopCorrelator.dpl \
PropertyInterface.conf
versioncs1_storage_SOURCES = versioncs1_storage.cc
versioncs1_storage_LDADD = libcs1_storage.la
versioncs1_storage_DEPENDENCIES = libcs1_storage.la $(LOFAR_DEPEND)
include $(top_srcdir)/Makefile.common
sysconf_DATA = CS1_Storage.log_prop
# -*- Mode:rpm-spec -*-
# CS1_Tools.spec.in
#
##############################################################################
#
# Preamble
#
##############################################################################
Summary: CS1_Tools is ... brief description ...
%define release @RPM_RELEASE@
%define version @VERSION@
%define pkgname @PACKAGE@
%define pkgdir %{pkgname}-%{version}-%{release}
%define prefix /opt/lofar
%define configure_args @RPM_CONFIGURE_ARGS@
##define build_kernel_version @BUILD_KERNEL_VERSION@
Name: %{pkgname}
Version: %{version}
Release: %{release}
Copyright: LGPL
Group: Application/System
Source: %{pkgname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{pkgdir}-root
URL: http://www.astron.nl
Prefix: %{prefix}
BuildArchitectures: i386 # Target platforms, i.e., i586
##Requires: Common = 1.2 ## define dependent packages here
Packager: %{packager}
Distribution: The LOFAR project
Vendor: ASTRON
AutoReqProv: no
%description
CS1_Tools ... more detailed description ...
##############################################################################
#
# prep
#
##############################################################################
%prep
echo $prefix
# create the build directory, untar the source
%setup
##############################################################################
#
# build
#
##############################################################################
%build
./configure %{configure_args} --prefix=%{prefix} && make
##############################################################################
#
# install
#
##############################################################################
%install
# To make things work with BUILDROOT
if [ "$RPM_BUILD_ROOT" != "%{_tmppath}/%{pkgdir}-root" ]
then
echo
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ @
echo @ RPM_BUILD_ROOT is not what I expected. Please clean it yourself. @
echo @ @
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo
else
echo Cleaning RPM_BUILD_ROOT: "$RPM_BUILD_ROOT"
rm -rf "$RPM_BUILD_ROOT"
fi
mkdir -p $RPM_BUILD_ROOT%{prefix}
make DESTDIR="$RPM_BUILD_ROOT" install
#uninstall
##############################################################################
#
# verify
#
##############################################################################
#verify
##############################################################################
#
# clean
#
##############################################################################
%clean
# Call me paranoid, but I do not want to be responsible for nuking
# someone's harddrive!
if [ "$RPM_BUILD_ROOT" != "%{_tmppath}/%{pkgdir}-root" ]
then
echo
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ @
echo @ RPM_BUILD_ROOT is not what I expected. Please clean it yourself. @
echo @ @
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo
else
echo Cleaning RPM_BUILD_ROOT: "$RPM_BUILD_ROOT"
rm -rf "$RPM_BUILD_ROOT"
fi
##############################################################################
#
# files
#
##############################################################################
# empty 'files' means all distributed files
%files
%defattr(-, root, root)
%{prefix}
# Your application file list goes here
# %{prefix}/lib/lib*.so*
# Documentation
# doc COPYING ChangeLog README AUTHORS NEWS
# doc doc/*
# link the module to the correct path
%post
# before uninstall
%preun
# after uninstall
%postun
##############################################################################
#
# package devel
#
##############################################################################
#package devel
#Summary: Development files for %{pkgname}
#Group: Applications/System
#description devel
#Development files for %{pkgname}.
#files devel
# Your development files go here
# Programmers documentation goes here
#doc doc
# end of file
SUBDIRS=src test include
pkgextdir = $(prefix)/config/$(PACKAGE)
pkgext_DATA = pkgext pkgextcppflags pkgextcxxflags pkgextldflags
DISTCHECK_CONFIGURE_FLAGS=\
--with-common=$(prefix)
EXTRA_DIST = \
Makefile.common \
CS1_Tools.spec \
autoconf_share/compiletool
include $(top_srcdir)/Makefile.common
#!/bin/sh
../../../../autoconf_share/bootstrap ../../../../autoconf_share
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT
dnl AC_CONFIG_AUX_DIR(config)
dnl AM_CONFIG_HEADER(config/config.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(CS1_Tools, 1.0, no-define)
dnl Initialize for LOFAR (may set compilers)
lofar_INIT
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_YACC
AC_PROG_CC
AC_PROG_CXX
AM_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
dnl Checks for libraries.
dnl dnl Replace `main' with a function in -lfl:
dnl AC_CHECK_LIB(fl, main)
dnl dnl Replace `main' with a function in -lcosev_r:
dnl AC_CHECK_LIB(cosev_r, main)
dnl dnl Replace `main' with a function in -lcosnm_r:
dnl AC_CHECK_LIB(cosnm_r, main)
dnl dnl Replace `main' with a function in -lorb_r:
dnl AC_CHECK_LIB(orb_r, main)
dnl dnl Replace `main' with a function in -lpthread:
dnl AC_CHECK_LIB(pthread, main)
dnl dnl Replace `main' with a function in -lvport_r:
dnl AC_CHECK_LIB(vport_r, main)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
dnl
dnl Check for LOFAR specific things
dnl
lofar_GENERAL
dnl lofar_BLITZ
dnl lofar_MPI
lofar_INTERNAL(LCS/Common,Common,,1,Common/LofarTypedefs.h)
dnl lofar_INTERNAL(LCS/AMC/AMCBase,AMCBase,,1,AMCBase/Converter.h)
dnl lofar_INTERNAL(LCS/AMC/AMCImpl,AMCImpl,,1,AMCImpl/ConverterImpl.h)
dnl lofar_INTERNAL(CEP/tinyCEP,tinyCEP,,1,tinyCEP/WorkHolder.h)
dnl lofar_INTERNAL(CEP/CEPFrame,CEPFrame,,1,CEPFrame/ApplicationHolder.h)
dnl lofar_INTERNAL(Appl/CEP/CS1/CS1_Interface,CS1_Interface,,1,CS1_Interface/CS1_Config.h)
dnl lofar_EXTERNAL(boost,1,boost/thread.hpp,"boost_date_time")
dnl
dnl Output Makefiles
dnl
AC_OUTPUT(
include/Makefile
include/CS1_Tools/Makefile
src/Makefile
test/Makefile
Makefile
CS1_Tools.spec
)
pkginclude_HEADERS = Package__Version.h
include $(top_srcdir)/Makefile.common
SUBDIRS = CS1_Tools
include $(top_srcdir)/Makefile.common
// \ingroup CS1
// \defgroup CS1_Tools CS1_Tools Description
lib_LTLIBRARIES = libcs1_tools.la
libcs1_tools_la_SOURCES = Package__Version.cc
INSTHDRS =
NOINSTHDRS =
TCCHDRS =
AM_CPPFLAGS = $(EXTRA_CPPFLAGS)
pkginclude_HEADERS = $(INSTHDRS) $(TCCHDRS)
noinst_HEADERS = $(NOINSTHDRS)
DOCHDRS = $(INSTHDRS) $(NOINSTHDRS)
bin_PROGRAMS = versioncs1_tools generator udp_copy
generator_SOURCES = $(DOCHDRS) \
generator.c
udp_copy_SOURCES = $(DOCHDRS) \
udp-copy.c
versioncs1_tools_SOURCES = versioncs1_tools.cc
versioncs1_tools_LDADD = libcs1_tools.la
versioncs1_tools_DEPENDENCIES = libcs1_tools.la $(LOFAR_DEPEND)
include $(top_srcdir)/Makefile.common
#!/bin/sh
#while :; do
# mpirun_rsh -np 16 lii001 lii001 lii002 lii003 lii004 lii004 lii005 lii006 lii007 lii007 lii008 lii009 lii010 lii010 lii011 lii012 udp-copy
# echo restart
#done
FILENAME=$1
ssh lii001 src/udp_copy 10.161.0.1:4346 10.170.0.2:4346 </dev/null & #CS001_RSP0
ssh lii001 src/udp_copy 10.161.0.1:4347 10.170.0.4:4347 </dev/null & #CS001_RSP1
ssh lii002 src/udp_copy 10.161.0.2:4348 10.170.0.1:4348 </dev/null & #CS001_RSP2
ssh lii002 src/udp_copy 10.161.0.2:4349 10.170.0.3:4349 </dev/null & #CS001_RSP3
ssh lii003 src/udp_copy 10.161.0.3:4346 10.170.0.10:4346 </dev/null & #CS008_RSP0
ssh lii003 src/udp_copy 10.161.0.3:4347 10.170.0.9:4347 </dev/null & #CS008_RSP1
ssh lii004 src/udp_copy 10.161.0.4:4348 10.170.0.12:4348 </dev/null & #CS008_RSP2
ssh lii004 src/udp_copy 10.161.0.4:4349 10.170.0.11:4349 </dev/null & #CS008_RSP3
ssh lii005 src/udp_copy 10.161.0.5:4346 10.170.0.18:4346 </dev/null & #CS010_RSP0
ssh lii005 src/udp_copy 10.161.0.5:4347 10.170.0.17:4347 </dev/null & #CS010_RSP1
ssh lii006 src/udp_copy 10.161.0.6:4348 10.170.0.20:4348 </dev/null & #CS010_RSP2
ssh lii006 src/udp_copy 10.161.0.6:4349 10.170.0.19:4349 </dev/null & #CS010_RSP3
ssh lii007 src/udp_copy 10.161.0.7:4346 10.170.0.26:4346 </dev/null & #CS031_RSP0
ssh lii007 src/udp_copy 10.161.0.7:4347 10.170.0.25:4347 </dev/null & #CS031_RSP1
ssh lii008 src/udp_copy 10.161.0.8:4348 10.170.0.28:4348 </dev/null & #CS031_RSP2
ssh lii008 src/udp_copy 10.161.0.8:4349 10.170.0.27:4349 </dev/null & #CS031_RSP3
ssh lii009 src/udp_copy 10.161.0.9:4346 10.170.0.34:4346 </dev/null & #CS032_RSP0
ssh lii009 src/udp_copy 10.161.0.9:4347 10.170.0.33:4347 </dev/null & #CS032_RSP1
ssh lii010 src/udp_copy 10.161.0.10:4348 10.170.0.36:4348 </dev/null & #CS032_RSP2
ssh lii010 src/udp_copy 10.161.0.10:4349 10.170.0.35:4349 </dev/null & #CS032_RSP3
ssh lii011 src/udp_copy 10.161.0.11:4346 10.170.0.42:4346 </dev/null & #CS016_RSP0
ssh lii011 src/udp_copy 10.161.0.11:4347 10.170.0.41:4347 </dev/null & #CS016_RSP1
ssh lii012 src/udp_copy 10.161.0.12:4348 10.170.0.44:4348 </dev/null & #CS016_RSP2
ssh lii012 src/udp_copy 10.161.0.12:4349 10.170.0.43:4349 </dev/null & #CS016_RSP3
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
volatile unsigned long long current_time;
double rate;
char packet[9000];
unsigned message_size;
int sk;
struct sockaddr_in sa;
unsigned packets_sent, errors;
void create_socket(const char *destination_ip, const char *destination_port)
{
struct hostent *host;
if ((sk = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
perror("socket");
exit(1);
}
if ((host = gethostbyname(destination_ip)) == 0) {
perror("gethostbyname");
exit(1);
}
memset(&sa, 0, sizeof sa);
sa.sin_family = AF_INET;
sa.sin_port = htons(atoi(destination_port));
memcpy(&sa.sin_addr, host->h_addr, host->h_length);
if (connect(sk, (struct sockaddr *) &sa, sizeof sa) < 0) {
perror("connect");
exit(1);
}
}
void send_packet()
{
// FIXME take care of endianness
* (int *) (packet + 8) = current_time / rate;
* (int *) (packet + 12) = fmod(current_time, rate);
++ packets_sent;
#if 1
if (send(sk, packet, message_size, 0) < 0) {
++ errors;
perror("send");
sleep(1);
}
#endif
}
int main(int argc, char **argv)
{
time_t last_time;
if (argc < 5 || argc > 6) {
fprintf(stderr, "usage: %s dest-ip dest-port rate subbands [samples-per-frame]\n", argv[0]);
exit(1);
}
create_socket(argv[1], argv[2]);
unsigned subbands = atoi(argv[4]);
unsigned samples_per_frame = argc == 6 ? atoi(argv[5]) : 16;
message_size = 16 + samples_per_frame * subbands * 8;
struct timeval tv;
rate = atof(argv[3]);
double interval = 1.0 / rate;
tv.tv_sec = interval;
tv.tv_usec = 1e6 * (interval - floor(interval));
printf("timer: %u sec, %u usec\n", tv.tv_sec, tv.tv_usec);
while (1) {
unsigned long long new_time;
do {
gettimeofday(&tv, 0);
new_time = (tv.tv_sec /*- 7200*/ + tv.tv_usec / 1000000.0) * rate;
} while (new_time < current_time + samples_per_frame);
current_time = new_time / samples_per_frame * samples_per_frame;
send_packet();
time_t current_wtime = time(0);
if (current_wtime != last_time) {
last_time = current_wtime;
fprintf(stderr, "sent %u packets to %s:%s, errors = %u\n", packets_sent, argv[1], argv[2], errors);
packets_sent = errors = 0;
}
}
return 0;
}
/* Copyright 2007, John W. Romein, Stichting ASTRON
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum proto { UDP, TCP, File };
int sk_in, sk_out;
char *source, *destination;
void setSendBufferSize(int sk, size_t size)
{
}
int create_IP_socket(char *arg, int is_output, enum proto proto)
{
char *colon;
struct sockaddr_in sa;
struct hostent *host;
int sk, old_sk, buffer_size = 8 * 1024 * 1024;
unsigned short port;
if ((colon = strchr(arg, ':')) == 0) {
fprintf(stderr, "badly formatted IP:PORT address");
exit(1);
}
port = colon[1] != '\0' ? atoi(colon + 1) : 0;
*colon = '\0';
if ((host = gethostbyname(arg)) == 0) {
perror("gethostbyname");
exit(1);
}
memset(&sa, 0, sizeof sa);
sa.sin_family = AF_INET;
sa.sin_port = htons(port);
memcpy(&sa.sin_addr, host->h_addr, host->h_length);
if ((sk = socket(AF_INET, proto == UDP ? SOCK_DGRAM : SOCK_STREAM, proto == UDP ? IPPROTO_UDP : IPPROTO_TCP)) < 0) {
perror("socket");
exit(1);
}
if (is_output) {
while (connect(sk, (struct sockaddr *) &sa, sizeof sa) < 0) {
if (errno == ECONNREFUSED) {
sleep(1);
} else {
perror("connect");
exit(1);
}
}
if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, &buffer_size, sizeof buffer_size) < 0)
perror("setsockopt failed");
} else {
if (bind(sk, (struct sockaddr *) &sa, sizeof sa) < 0) {
perror("bind");
exit(1);
}
if (proto == TCP) {
listen(sk, 5);
old_sk = sk;
if ((sk = accept(sk, 0, 0)) < 0) {
perror("accept");
exit(1);
}
close(old_sk);
}
if (setsockopt(sk, SOL_SOCKET, SO_RCVBUF, &buffer_size, sizeof buffer_size) < 0)
perror("setsockopt failed");
}
return sk;
}
int create_file(char *arg, int is_output)
{
int fd;
if ((fd = open(arg, is_output ? O_CREAT | O_WRONLY : O_RDONLY, 0666)) < 0) {
perror("opening input file");
exit(1);
}
return fd;
}
int create_socket(char *arg, int is_output)
{
enum proto proto;
if (strncmp(arg, "udp:", 4) == 0 || strncmp(arg, "UDP:", 4) == 0) {
proto = UDP;
arg += 4;
} else if (strncmp(arg, "tcp:", 4) == 0 || strncmp(arg, "TCP:", 4) == 0) {
proto = TCP;
arg += 4;
} else if (strncmp(arg, "file:", 5) == 0 || strncmp(arg, "FILE:", 5) == 0) {
proto = File;
arg += 5;
} else if (strchr(arg, ':') != 0) {
proto = UDP;
} else {
proto = File;
}
if (is_output)
destination = arg;
else
source = arg;
switch (proto) {
case UDP :
case TCP : return create_IP_socket(arg, is_output, proto);
case File : return create_file(arg, is_output);
}
}
void init(int argc, char **argv)
{
if (argc != 3) {
fprintf(stderr, "Usage: \"%s src-addr dest-addr\", where addr is [tcp:|udp:]ip-addr:port or [file:]filename\n", argv[0]);
exit(1);
}
sk_in = create_socket(argv[1], 0);
sk_out = create_socket(argv[2], 1);
setlinebuf(stdout);
}
int main(int argc, char **argv)
{
time_t previous_time = 0, current_time;
unsigned i, forwarded = 0;
init(argc, argv);
while (1) {
char buffer[9000];
int size;
while ((size = read(sk_in, buffer, 9000)) != 0) {
if (size < 0) {
perror("read");
sleep(1);
} else if (write(sk_out, buffer, size) < size) {
perror("write");
sleep(1);
}
++ forwarded;
if ((current_time = time(0)) != previous_time) {
previous_time = current_time;
printf("forwarded %u packets from %s to %s\n", forwarded, source, destination);
forwarded = 0;
}
}
}
return 0;
}
check_PROGRAMS =
# programs to run through supplied checktools
CHECKTOOLPROGS =
#ENDCHECKTOOLPROGS
# scripts and possible programs to run tests
TESTS =
XFAIL_TESTS =
# all files (.run, .stdout, .in, .log_prop, etc.) needed to run tests
EXTRA_DIST = $(TESTS)
include $(top_srcdir)/Makefile.common
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment