Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/notedump: Add a example to dump trace data by udp #3026

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions examples/notedump/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ##############################################################################
# apps/examples/notedump/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_EXAMPLES_NOTEDUMP)
nuttx_add_application(NAME notedump)
endif()
30 changes: 30 additions & 0 deletions examples/notedump/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config EXAMPLES_NOTEDUMP
tristate "Note dump example"
default n
depends on SCHED_INSTRUMENTATION_DUMP && NET_UDP
---help---
Enable the Note dump example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the help text can include a short blurb about what the note dump example does? Something like: "This example reads data from the Note driver (/dev/note/ram) and sends it by UDP to the server-addr and server-port specified by command line arguments." WDYT?


if EXAMPLES_NOTEDUMP

config EXAMPLES_NOTEDUMP_PROGNAME
string "Program name"
default "notedump"
---help---
This is the name of the program that will be used when the NSH ELF
program is installed.

config EXAMPLES_NOTEDUMP_PRIORITY
int "Note dump task priority"
default 100

config EXAMPLES_NOTEDUMP_STACKSIZE
int "Note dump stack size"
default DEFAULT_TASK_STACKSIZE

endif
25 changes: 25 additions & 0 deletions examples/notedump/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
############################################################################
# apps/examples/notedump/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

ifneq ($(CONFIG_EXAMPLES_NOTEDUMP),)
CONFIGURED_APPS += $(APPDIR)/examples/notedump
endif
32 changes: 32 additions & 0 deletions examples/notedump/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
############################################################################
# apps/examples/notedump/Makefile
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

include $(APPDIR)/Make.defs

PROGNAME = $(CONFIG_EXAMPLES_NOTEDUMP_PROGNAME)
PRIORITY = $(CONFIG_EXAMPLES_NOTEDUMP_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_NOTEDUMP_STACKSIZE)
MODULE = $(CONFIG_EXAMPLES_NOTEDUMP_)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MODULE = $(CONFIG_EXAMPLES_NOTEDUMP_)
MODULE = $(CONFIG_EXAMPLES_NOTEDUMP)


MAINSRC = notedump_main.c

include $(APPDIR)/Application.mk
57 changes: 57 additions & 0 deletions examples/notedump/notedump.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/****************************************************************************
* apps/examples/notedump/notedump.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __APPS_EXAMPLES_NOTEDUMP_H
#define __APPS_EXAMPLES_NOTEDUMP_H

/****************************************************************************
* Included Files
****************************************************************************/

#ifdef EXAMPLES_UDP_HOST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is EXAMPLES_UDP_HOST define?

#else
# include <debug.h>
#endif

#include <arpa/inet.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#ifdef CONFIG_EXAMPLES_UDP_IPv6
# define AF_INETX AF_INET6
# define PF_INETX PF_INET6
#else
# define AF_INETX AF_INET
# define PF_INETX PF_INET
#endif
Comment on lines +41 to +47
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should we replace EXAMPLES_UDP_IPv6 with NET_IPv6 ?
  2. Could you explain where are AF_INETX and PF_INETX used for?


#ifndef CONFIG_EXAMPLES_NOTEDUMP_SERVER_PORTNO
# define CONFIG_EXAMPLES_NOTEDUMP_SERVER_PORTNO 6666
#endif

#ifndef CONFIG_EXAMPLES_NOTEDUMP_METRIC_FREQ
# define CONFIG_EXAMPLES_NOTEDUMP_METRIC_FREQ 10
#endif

#endif /* __APPS_EXAMPLES_NOTEDUMP_H */
Loading
Loading