zs39 opened a new pull request, #3279:
URL: https://github.com/apache/nuttx-apps/pull/3279
## Summary
Obtain detailed IOB information by parsing the /proc/iobinfo file.
## Impact
The new feature does not affect the functionality of existing code.
## Testing
The following code works correctly during testing.
```
/****************************************************************************
* apps/examples/hello/hello_main.c
*
* 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <errno.h>
#include <netutils/netlib.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* hello_main
****************************************************************************/
int main(int argc, FAR char *argv[])
{
#ifdef CONFIG_MM_IOB
struct iob_stats_s iob_stats;
int ret;
printf("Hello, World!!\n");
printf("\n=== IOB Statistics ===\n");
ret = netlib_get_iobinfo(&iob_stats);
if (ret == 0)
{
printf("Total IOBs: %d\n", iob_stats.ntotal);
printf("Free IOBs: %d\n", iob_stats.nfree);
printf("Waiting tasks: %d\n", iob_stats.nwait);
printf("Throttled: %d\n", iob_stats.nthrottle);
printf("\n");
}
else
{
printf("Failed to get IOB info: %d (errno: %d)\n", ret, errno);
}
#else
printf("Hello, World!!\n");
printf("IOB support is not enabled (CONFIG_MM_IOB)\n");
#endif
return 0;
}
```
The output is as follows
```
nsh> hello
Hello, World!!
=== IOB Statistics ===
Total IOBs: 1024
Free IOBs: 1024
Waiting tasks: 0
Throttled: 768
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]