Skip to content

Commit c8beebf

Browse files
committed
examples/notedump: Add a example to dump trace data by udp
Add example to send the trace data by udp Signed-off-by: Yang Wei <[email protected]>
1 parent 0639a2a commit c8beebf

File tree

6 files changed

+432
-0
lines changed

6 files changed

+432
-0
lines changed

examples/notedump/CMakeLists.txt

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# ##############################################################################
2+
# apps/examples/notedump/CMakeLists.txt
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
7+
# license agreements. See the NOTICE file distributed with this work for
8+
# additional information regarding copyright ownership. The ASF licenses this
9+
# file to you under the Apache License, Version 2.0 (the "License"); you may not
10+
# use this file except in compliance with the License. You may obtain a copy of
11+
# the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
# License for the specific language governing permissions and limitations under
19+
# the License.
20+
#
21+
# ##############################################################################
22+
23+
if(CONFIG_EXAMPLES_NOTEDUMP)
24+
nuttx_add_application(NAME notedump)
25+
endif()

examples/notedump/Kconfig

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# For a description of the syntax of this configuration file,
3+
# see the file kconfig-language.txt in the NuttX tools repository.
4+
#
5+
6+
config EXAMPLES_NOTEDUMP
7+
tristate "Note dump example"
8+
default n
9+
depends on SCHED_INSTRUMENTATION_DUMP && NET_UDP
10+
---help---
11+
Enable the Note dump example
12+
13+
if EXAMPLES_NOTEDUMP
14+
15+
config EXAMPLES_NOTEDUMP_PROGNAME
16+
string "Program name"
17+
default "notedump"
18+
---help---
19+
This is the name of the program that will be used when the NSH ELF
20+
program is installed.
21+
22+
config EXAMPLES_NOTEDUMP_PRIORITY
23+
int "Note dump task priority"
24+
default 100
25+
26+
config EXAMPLES_NOTEDUMP_STACKSIZE
27+
int "Note dump stack size"
28+
default DEFAULT_TASK_STACKSIZE
29+
30+
endif

examples/notedump/Make.defs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
############################################################################
2+
# apps/examples/notedump/Make.defs
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more
7+
# contributor license agreements. See the NOTICE file distributed with
8+
# this work for additional information regarding copyright ownership. The
9+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
# "License"); you may not use this file except in compliance with the
11+
# License. You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
# License for the specific language governing permissions and limitations
19+
# under the License.
20+
#
21+
############################################################################
22+
23+
ifneq ($(CONFIG_EXAMPLES_NOTEDUMP),)
24+
CONFIGURED_APPS += $(APPDIR)/examples/notedump
25+
endif

examples/notedump/Makefile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
############################################################################
2+
# apps/examples/notedump/Makefile
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more
7+
# contributor license agreements. See the NOTICE file distributed with
8+
# this work for additional information regarding copyright ownership. The
9+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
# "License"); you may not use this file except in compliance with the
11+
# License. You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
# License for the specific language governing permissions and limitations
19+
# under the License.
20+
#
21+
############################################################################
22+
23+
include $(APPDIR)/Make.defs
24+
25+
PROGNAME = $(CONFIG_EXAMPLES_NOTEDUMP_PROGNAME)
26+
PRIORITY = $(CONFIG_EXAMPLES_NOTEDUMP_PRIORITY)
27+
STACKSIZE = $(CONFIG_EXAMPLES_NOTEDUMP_STACKSIZE)
28+
MODULE = $(CONFIG_EXAMPLES_NOTEDUMP_)
29+
30+
MAINSRC = notedump_main.c
31+
32+
include $(APPDIR)/Application.mk

examples/notedump/notedump.h

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/****************************************************************************
2+
* apps/examples/notedump/notedump.h
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one or more
7+
* contributor license agreements. See the NOTICE file distributed with
8+
* this work for additional information regarding copyright ownership. The
9+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
* "License"); you may not use this file except in compliance with the
11+
* License. You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
* License for the specific language governing permissions and limitations
19+
* under the License.
20+
*
21+
****************************************************************************/
22+
23+
#ifndef __APPS_EXAMPLES_NOTEDUMP_H
24+
#define __APPS_EXAMPLES_NOTEDUMP_H
25+
26+
/****************************************************************************
27+
* Included Files
28+
****************************************************************************/
29+
30+
#ifdef EXAMPLES_UDP_HOST
31+
#else
32+
# include <debug.h>
33+
#endif
34+
35+
#include <arpa/inet.h>
36+
37+
/****************************************************************************
38+
* Pre-processor Definitions
39+
****************************************************************************/
40+
41+
#ifdef CONFIG_EXAMPLES_UDP_IPv6
42+
# define AF_INETX AF_INET6
43+
# define PF_INETX PF_INET6
44+
#else
45+
# define AF_INETX AF_INET
46+
# define PF_INETX PF_INET
47+
#endif
48+
49+
#ifndef CONFIG_EXAMPLES_NOTEDUMP_SERVER_PORTNO
50+
# define CONFIG_EXAMPLES_NOTEDUMP_SERVER_PORTNO 6666
51+
#endif
52+
53+
#ifndef CONFIG_EXAMPLES_NOTEDUMP_METRIC_FREQ
54+
# define CONFIG_EXAMPLES_NOTEDUMP_METRIC_FREQ 10
55+
#endif
56+
57+
#endif /* __APPS_EXAMPLES_NOTEDUMP_H */

0 commit comments

Comments
 (0)