⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 size.c

📁 RTEMS (Real-Time Executive for Multiprocessor Systems) is a free open source real-time operating sys
💻 C
📖 第 1 页 / 共 2 页
字号:
/*  main * *  This program is run to determine the data space and work space *  requirements of the current version of RTEMS. * *  COPYRIGHT (c) 1989-1999. *  On-Line Applications Research Corporation (OAR). * *  The license and distribution terms for this file may be *  found in the file LICENSE in this distribution or at *  http://www.rtems.com/license/LICENSE. * *  $Id: size.c,v 1.41.2.2 2003/09/04 18:46:38 joel Exp $ */#include <rtems/system.h>#include <rtems/config.h>#include <rtems/score/apiext.h>#include <rtems/score/copyrt.h>#include <rtems/rtems/clock.h>#include <rtems/rtems/tasks.h>#include <rtems/rtems/dpmem.h>#include <rtems/rtems/event.h>#include <rtems/extension.h>#include <rtems/fatal.h>#include <rtems/init.h>#include <rtems/score/isr.h>#include <rtems/rtems/intr.h>#include <rtems/io.h>#include <rtems/rtems/message.h>#if defined(RTEMS_MULTIPROCESSING)#include <rtems/rtems/mp.h>#include <rtems/score/mpci.h>#endif#include <rtems/rtems/part.h>#include <rtems/score/priority.h>#include <rtems/rtems/ratemon.h>#include <rtems/rtems/region.h>#include <rtems/rtems/sem.h>#include <rtems/rtems/signal.h>#include <rtems/score/sysstate.h>#include <rtems/score/thread.h>#include <rtems/rtems/timer.h>#include <rtems/score/tod.h>#include <rtems/score/userext.h>#include <rtems/score/wkspace.h>#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <tmacros.h>/* external function prototypes */int getint( void );/* These are always defined by the executive. * * #include <rtems/copyrt.h> * #include <rtems/tables.h> * #include <rtems/sptables.h> */#define  HEAP_OVHD        16    /* wasted heap space per task stack */#define  NAME_PTR_SIZE     8    /* size of name and pointer table entries */#define  READYCHAINS_SIZE  \    ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control ))#define PER_TASK      \     (long) (sizeof (Thread_Control) + \      NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control ))#define PER_SEMAPHORE \     (long) (sizeof (Semaphore_Control) + NAME_PTR_SIZE)#define PER_TIMER     \     (long) (sizeof (Timer_Control) + NAME_PTR_SIZE)#define PER_MSGQ      \     (long) (sizeof (Message_queue_Control) + NAME_PTR_SIZE)#define PER_REGN      \     (long) (sizeof (Region_Control) + NAME_PTR_SIZE)#define PER_PART      \     (long) (sizeof (Partition_Control) + NAME_PTR_SIZE)#define PER_PERIOD      \     (long) (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE)#define PER_PORT      \     (long) (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE)#define PER_EXTENSION     \     (long) (sizeof (Extension_Control) + NAME_PTR_SIZE)#define PER_DRV       (long) (0)#define PER_FPTASK    (long) (CONTEXT_FP_SIZE)#define PER_GOBTBL    (long) (sizeof (Chain_Control)*4)#define PER_NODE      (long) PER_GOBTBL#if defined(RTEMS_MULTIPROCESSING)#define PER_GOBJECT   (long) (sizeof (Objects_MP_Control))#else#define PER_GOBJECT   (long) 0#endif#define PER_PROXY     (long) (sizeof (Thread_Proxy_control))#if !defined(RTEMS_MULTIPROCESSING) || (CPU_ALL_TASKS_ARE_FP != TRUE)#define MPCI_RECEIVE_SERVER_FP (long) 0#else#define MPCI_RECEIVE_SERVER_FP (long) (sizeof( Context_Control_fp ))#endif#if (CPU_IDLE_TASK_IS_FP == TRUE)#define SYSTEM_IDLE_FP (long) (sizeof( Context_Control_fp ))#else#define SYSTEM_IDLE_FP (long) 0#endif#if !defined(RTEMS_MULTIPROCESSING)#define MPCI_RECEIVE_SERVER_STACK_SIZE 0#endif#if defined(RTEMS_MULTIPROCESSING)#define MP_SYSTEM_TASKS \   (MPCI_RECEIVE_SERVER_STACK_SIZE + \    sizeof(Thread_Control) + \    MPCI_RECEIVE_SERVER_FP)#else#define MP_SYSTEM_TASKS 0#endif/* *  Idle and the MPCI Receive Server Threads */#define SYSTEM_TASKS  \    (STACK_MINIMUM_SIZE + sizeof(Thread_Control) + SYSTEM_IDLE_FP + \     MP_SYSTEM_TASKS)#define rtems_unsigned32 unsigned32rtems_unsigned32 sys_req;void help_size();void print_formula();void size_rtems(  int mode){int uninitialized = 0;int initialized = 0;/* *  The following data is allocated for each Manager: * *    + Per Manager Object Information *      - local pointer table *      - local name table *      - the object's control blocks *      - global name chains * *  The following is the data allocate from the RTEMS Workspace Area. *  The order indicates the order in which RTEMS allocates it. * *    + Object MP *      - Global Object CB's *    + Thread *      - Ready Chain *    + Thread MP *      - Proxies Chain *    + Interrupt Manager *      - Interrupt Stack *    + Timer Manager *      - per Manager Object Data *    + Extension Manager *      - per Manager Object Data *    + Message Queue Manager *      - per Manager Object Data *      - Message Buffers *    + Semaphore Manager *      - per Manager Object Data *    + Partition Manager *      - per Manager Object Data *    + Region Manager *      - per Manager Object Data *    + Dual Ported Memory Manager *      - per Manager Object Data *    + Rate Monotonic Manager *      - per Manager Object Data *    + Internal Threads Handler *      - MPCI Receive Server Thread TCB *      - IDLE Thread TCB *      - MPCI Receive Server Thread stack *      - MPCI Receive Server Thread FP area (if CPU requires this) *      - IDLE Thread stack *      - IDLE Thread FP area (if CPU requires this) * *  This does not take into account any CPU dependent alignment requirements. * *  The following calculates the overhead needed by RTEMS from the *  Workspace Area. */sys_req = SYSTEM_TASKS     +     /* MPCI Receive Server and IDLE */          NAME_PTR_SIZE    +     /* Task Overhead */          READYCHAINS_SIZE +     /* Ready Chains */          NAME_PTR_SIZE    +     /* Timer Overhead */          NAME_PTR_SIZE    +     /* Semaphore Overhead */          NAME_PTR_SIZE    +     /* Message Queue Overhead */          NAME_PTR_SIZE    +     /* Region Overhead */          NAME_PTR_SIZE    +     /* Partition Overhead */          NAME_PTR_SIZE    +     /* Dual-Ported Memory Overhead */          NAME_PTR_SIZE    +     /* Rate Monotonic Overhead */          NAME_PTR_SIZE    +     /* Extension Overhead */          PER_NODE;              /* Extra Gobject Table */uninitialized =/*address.h*/   0                                         +/*apiext.h*/    (sizeof _API_extensions_List)             +/*asr.h*/       0                                         +/*attr.h*/      0                                         +/*bitfield.h*/  0                                         +/*chain.h*/     0                                         +/*clock.h*/     0                                         +/*config.h*/    (sizeof _Configuration_Table)             +                (sizeof _Configuration_MP_table)          +/*context.h*/   (sizeof _Context_Switch_necessary)        +/*copyrt.h*/    0                                         +/*debug.h*/     (sizeof _Debug_Level)                     +/*dpmem.h*/     (sizeof _Dual_ported_memory_Information)  +/*event.h*/     (sizeof _Event_Sync_state)                +#if defined(RTEMS_MULTIPROCESSING)/*eventmp.h*/   0                                         +#endif/*eventset.h*/  0                                         +/*extension.h*/ (sizeof _Extension_Information)           +/*fatal.h*/     0                                         +/*heap.h*/      0                                         +/*init.h*/      0                                         +/*interr.h*/    (sizeof Internal_errors_What_happened)    +/*intr.h*/      0                                         +/*io.h*/        (sizeof _IO_Number_of_drivers)            +                (sizeof _IO_Driver_address_table)         +                (sizeof _IO_Number_of_devices)            +                (sizeof _IO_Driver_name_table)            +/*isr.h*/       (sizeof _ISR_Nest_level)                  +                (sizeof _ISR_Vector_table)                +                (sizeof _ISR_Signals_to_thread_executing) +/*message.h*/   (sizeof _Message_queue_Information)       +/*modes.h*/     0                                         +#if defined(RTEMS_MULTIPROCESSING)/*mp.h*/        0                                         +#endif#if defined(RTEMS_MULTIPROCESSING)/*mpci.h*/      (sizeof _MPCI_Remote_blocked_threads)     +                (sizeof _MPCI_Semaphore)                  +                (sizeof _MPCI_table)                      +                (sizeof _MPCI_Receive_server_tcb)         +                (sizeof _MPCI_Packet_processors)          +#endif#if defined(RTEMS_MULTIPROCESSING)/*mppkt.h*/     0                                         +#endif#if defined(RTEMS_MULTIPROCESSING)/*mptables.h*/  0                                         +#endif#if defined(RTEMS_MULTIPROCESSING)/*msgmp.h*/     0                                         +#endif/*object.h*/    (sizeof _Objects_Local_node)              +                (sizeof _Objects_Maximum_nodes)           +                (sizeof _Objects_Information_table)       +#if defined(RTEMS_MULTIPROCESSING)/*objectmp.h*/  (sizeof _Objects_MP_Maximum_global_objects) +                (sizeof _Objects_MP_Inactive_global_objects) +#endif/*options.h*/   0                                         +/*part.h*/      (sizeof _Partition_Information)           +#if defined(RTEMS_MULTIPROCESSING)/*partmp.h*/    0                                         +#endif/*priority.h*/  (sizeof _Priority_Major_bit_map)          +                (sizeof _Priority_Bit_map)                +/*ratemon.h*/   (sizeof _Rate_monotonic_Information)      +/*region.h*/    (sizeof _Region_Information)              +#if defined(RTEMS_MULTIPROCESSING)/*regionmp.h*/  0                                         +#endif/*rtems.h*/     /* Not applicable *//*sem.h*/       (sizeof _Semaphore_Information)           +#if defined(RTEMS_MULTIPROCESSING)/*semmp.h*/     0                                         +#endif/*signal.h*/    0                                         +/*signalmp.h*/  0                                         +/*stack.h*/     0                                         +/*states.h*/    0                                         +/*status.h*/    0                                         +/*sysstate.h*/  (sizeof _System_state_Is_multiprocessing) +                (sizeof _System_state_Current)            +/*system.h*/    (sizeof _CPU_Table)                       +#if defined(RTEMS_MULTIPROCESSING)/*taskmp.h*/    0                                         +#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -