1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: System Services -- Memory management interface
25 Desc: Implementation of the memory management interface.
29 *********************************************************************21*/
32 /* header include files (.h) */
34 #include "envopt.h" /* environment options */
35 #include "envdep.h" /* environment dependent */
36 #include "envind.h" /* environment independent */
38 #include "gen.h" /* general layer */
39 #include "ssi.h" /* system services */
41 #include "ss_err.h" /* errors */
42 #include "ss_dep.h" /* implementation-specific */
43 #include "ss_queue.h" /* queues */
44 #include "ss_msg.h" /* messaging */
45 #include "ss_mem.h" /* memory management interface */
46 /*ss011.301 : RMI SSI specific includes*/
48 #include "uc_gen.h" /* general */
50 #include "ss_gen.h" /* general */
54 #include "cm_mem.h" /* common memory manager */
58 /* header/extern include files (.x) */
60 #include "gen.x" /* general layer */
61 #include "ssi.x" /* system services */
63 #include "ss_dep.x" /* implementation-specific */
64 #include "ss_queue.x" /* queues */
65 /*ss011.301 : RMI SSI specific includes*/
67 #include "uc_task.x" /* tasking */
68 #include "uc_timer.x" /* timers */
70 #include "ss_task.x" /* tasking */
71 #include "ss_timer.x" /* timers */
73 #include "ss_strm.x" /* STREAMS */
74 #include "ss_msg.x" /* messaging */
75 #include "ss_mem.x" /* memory management interface */
76 #include "ss_drvr.x" /* driver tasks */
77 /*ss011.301 : RMI SSI specific includes*/
78 #ifdef SS_LOCKLESS_MEMORY
81 #include "cm_mem_wl.x" /* common memory manager */
83 #include "cm_mem.x" /* common memory manager */
84 #endif /* SS_LOCKLESS_MEMORY */
86 #include "uc_gen.x" /* general */
88 #include "ss_gen.x" /* general */
104 * Desc: Registers a memory region.
107 * RFAILED - failed, general (optional)
116 Region region, /* region ID */
117 SRegInfo *regInfo /* information about the region */
122 #if (ERRCLASS & ERRCLS_INT_PAR)
123 /* validate region ID */
124 if (region >= SS_MAX_REGS)
126 SSLOGERROR(ERRCLS_INT_PAR, ESS028, region, "Invalid region");
130 /* validate region info pointer */
131 if (regInfo == NULLP)
133 SSLOGERROR(ERRCLS_INT_PAR, ESS029, ERRZERO, "Null pointer");
139 /* lock the region table */
140 SS_ACQUIRE_ALL_SEMA(&osCp.regionTblSem, ret);
144 #if (ERRCLASS & ERRCLS_DEBUG)
145 SSLOGERROR(ERRCLS_DEBUG, ESS030, (ErrVal) ret,
146 "Could not lock region table");
153 #if (ERRCLASS & ERRCLS_INT_PAR)
154 /* verify that this region is not registered */
155 if (osCp.dynRegionTbl[region].used == TRUE)
157 SS_RELEASE_ALL_SEMA(&osCp.regionTblSem);
159 SSLOGERROR(ERRCLS_INT_PAR, ESS031, ERRZERO, "Region ID used");
165 /* fill in the region information */
166 osCp.dynRegionTbl[region].used = TRUE;
167 osCp.dynRegionTbl[region].regCb = regInfo->regCb;
168 osCp.dynRegionTbl[region].flags = regInfo->flags;
169 osCp.dynRegionTbl[region].start = regInfo->start;
170 osCp.dynRegionTbl[region].size = regInfo->size;
171 osCp.dynRegionTbl[region].alloc = regInfo->alloc;
172 osCp.dynRegionTbl[region].free = regInfo->free;
173 osCp.dynRegionTbl[region].ctl = regInfo->ctl;
175 osCp.numDynRegions++;
178 /* unlock the region table */
179 SS_RELEASE_ALL_SEMA(&osCp.regionTblSem);
192 * Desc: Registers a memory region.
195 * RFAILED - failed, general (optional)
204 Region region, /* region ID */
205 SRegInfo *regInfo /* information about the region */
210 #if (ERRCLASS & ERRCLS_INT_PAR)
211 /* validate region ID */
212 if (region >= SS_MAX_REGS)
214 SSLOGERROR(ERRCLS_INT_PAR, ESS028, region, "Invalid region");
218 /* validate region info pointer */
219 if (regInfo == NULLP)
221 SSLOGERROR(ERRCLS_INT_PAR, ESS029, ERRZERO, "Null pointer");
227 /* lock the region table */
228 SS_ACQUIRE_ALL_SEMA(&osCp.regionTblSem, ret);
232 #if (ERRCLASS & ERRCLS_DEBUG)
233 SSLOGERROR(ERRCLS_DEBUG, ESS030, (ErrVal) ret,
234 "Could not lock region table");
241 #if (ERRCLASS & ERRCLS_INT_PAR)
242 /* verify that this region is not registered */
243 if (osCp.regionTbl[region].used == TRUE)
245 SS_RELEASE_ALL_SEMA(&osCp.regionTblSem);
247 SSLOGERROR(ERRCLS_INT_PAR, ESS031, ERRZERO, "Region ID used");
253 /* fill in the region information */
254 osCp.regionTbl[region].used = TRUE;
255 osCp.regionTbl[region].regCb = regInfo->regCb;
256 osCp.regionTbl[region].flags = regInfo->flags;
257 osCp.regionTbl[region].start = regInfo->start;
258 osCp.regionTbl[region].size = regInfo->size;
259 osCp.regionTbl[region].alloc = regInfo->alloc;
260 osCp.regionTbl[region].free = regInfo->free;
261 osCp.regionTbl[region].ctl = regInfo->ctl;
266 /* unlock the region table */
267 SS_RELEASE_ALL_SEMA(&osCp.regionTblSem);
278 * Desc: Deregisters a memory region.
281 * RFAILED - failed, general (optional)
290 Region region /* region ID */
295 #if (ERRCLASS & ERRCLS_INT_PAR)
296 /* validate region ID */
297 if (region >= SS_MAX_REGS)
299 SSLOGERROR(ERRCLS_INT_PAR, ESS032, region, "Invalid region");
305 /* lock the region table */
306 SS_ACQUIRE_ALL_SEMA(&osCp.regionTblSem, ret);
310 #if (ERRCLASS & ERRCLS_DEBUG)
311 SSLOGERROR(ERRCLS_DEBUG, ESS033, (ErrVal) ret,
312 "Could not lock region table");
319 #if (ERRCLASS & ERRCLS_INT_PAR)
320 /* check if this region is registered */
321 if (osCp.regionTbl[region].used == FALSE)
323 SS_RELEASE_ALL_SEMA(&osCp.regionTblSem);
324 SSLOGERROR(ERRCLS_INT_PAR, ESS034, region, "Region not registered");
330 /* empty the information about the region */
331 osCp.regionTbl[region].used = FALSE;
332 osCp.regionTbl[region].start = NULLP;
333 osCp.regionTbl[region].size = 0;
334 osCp.regionTbl[region].regCb = NULLP;
335 osCp.regionTbl[region].flags = 0;
336 osCp.regionTbl[region].alloc = NULLP;
337 osCp.regionTbl[region].free = NULLP;
338 osCp.regionTbl[region].ctl = NULLP;
343 /* unlock the region table */
344 SS_RELEASE_ALL_SEMA(&osCp.regionTblSem);
355 * Desc: Allocates a block of memory of at least the specified
359 * RFAILED - failed, general (optional)
366 /*ss003.301-gaurded under flag SS_FAP*/
368 /* ss001.301: Additions */
369 #ifdef SS_HISTOGRAM_SUPPORT
372 Region region, /* region ID */
373 Size *size, /* size of block required/allocated */
374 uint32_t flags, /* allocation flags */
375 Data **ptr, /* filled with pointer to block */
381 #ifdef T2K_MEM_LEAK_DBG
384 Region region, /* region ID */
385 Size *size, /* size of block required/allocated */
386 uint32_t flags, /* allocation flags */
387 Data **ptr, /* filled with pointer to block */
394 Region region, /* region ID */
395 Size *size, /* size of block required/allocated */
396 uint32_t flags, /* allocation flags */
397 Data **ptr /* filled with pointer to block */
403 /* ss001.301: Additions */
404 #ifdef SS_HISTOGRAM_SUPPORT
406 #endif /* SS_HISTOGRAM_SUPPORT */
411 #if (ERRCLASS & ERRCLS_INT_PAR)
412 /* validate region ID */
413 if (region >= SS_MAX_REGS)
415 SSLOGERROR(ERRCLS_INT_PAR, ESS035, region, "Invalid region");
419 #ifndef XEON_SPECIFIC_CHANGES
420 /* Get the region which is assgined with this thread. The region was
421 * stored in the osCp and is taken with respect to thread ID. This macro
422 * is used only when SS_LOCKLESS_MEMORY flag is used and it overwrites
425 region = SS_GET_THREAD_MEM_REGION();
427 /* ss037.103 Removed the semaphore acquisition for performance enhancement */
429 /* acquire one semaphore, to protect against deregistration */
430 SS_ACQUIRE_SEMA(&osCp.regionTblSem, ret);
434 #if (ERRCLASS & ERRCLS_DEBUG)
435 SSLOGERROR(ERRCLS_DEBUG, ESS036, (ErrVal) ret,
436 "Could not lock region table");
443 #if (ERRCLASS & ERRCLS_INT_PAR)
444 /* verify that this region is present */
445 if (osCp.regionTbl[region].used == FALSE)
447 /* ss037.103 Removed the semaphore operation for performance enhancement */
449 /* ss006.13: addition */
450 if( SS_RELEASE_SEMA(&osCp.regionTblSem) != ROK)
452 #if (ERRCLASS & ERRCLS_DEBUG)
453 SSLOGERROR(ERRCLS_DEBUG, ESS037, ERRZERO,
454 "Could not release the semaphore");
459 SSLOGERROR(ERRCLS_INT_PAR, ESS038, region, "Region not registered");
463 /* ss001.301: Additions */
464 #ifdef SS_HISTOGRAM_SUPPORT
465 SGetHstGrmInfo(&entId, &hstReg);
466 /* call the memory manager, to allocate this memory */
467 /* ss036.103 - addition for passing memType as dynamic */
468 #ifdef SSI_DEBUG_LEVEL1
469 ret = (osCp.regionTbl[region].alloc)
470 (osCp.regionTbl[region].regCb, size, flags, ptr,
471 SS_DYNAMIC_MEM_FLAG, line, fileName, entId, hstReg);
473 ret = (osCp.regionTbl[region].alloc)
474 (osCp.regionTbl[region].regCb, size, flags, ptr, line,
475 fileName, entId, hstReg);
476 #endif /* SSI_DEBUG_LEVEL1 */
480 /* call the memory manager, to allocate this memory */
481 /* ss036.103 - addition for passing memType as dynamic */
482 #ifdef SSI_DEBUG_LEVEL1
483 ret = (osCp.regionTbl[region].alloc)
484 (osCp.regionTbl[region].regCb, size, flags, ptr, SS_DYNAMIC_MEM_FLAG);
486 #ifdef SS_LOCKLESS_MEMORY
487 #ifdef T2K_MEM_LEAK_DBG
488 ret = (osCp.dynRegionTbl[region].alloc)
489 (osCp.dynRegionTbl[region].regCb, size, flags, ptr,file,line);
491 ret = (osCp.dynRegionTbl[region].alloc)
492 (osCp.dynRegionTbl[region].regCb, size, flags, ptr);
495 #ifdef T2K_MEM_LEAK_DBG
496 ret = (osCp.regionTbl[region].alloc)
497 (osCp.regionTbl[region].regCb, size, flags, ptr,file,line);
499 ret = (osCp.regionTbl[region].alloc)
500 (osCp.regionTbl[region].regCb, size, flags, ptr);
502 #endif /* SS_LOCKLESS_MEMORY */
503 #endif /* SSI_DEBUG_LEVEL1 */
505 #endif /* SS_HISTOGRAM_SUPPORT */
507 /* ss037.103 Removed the semaphore operation for performance enhancement */
510 /* release the semaphore we took */
511 /* ss006.13: addition */
512 if( SS_RELEASE_SEMA(&osCp.regionTblSem) != ROK)
514 #if (ERRCLASS & ERRCLS_DEBUG)
515 SSLOGERROR(ERRCLS_DEBUG, ESS039, ERRZERO,
516 "Could not release the semaphore");
521 /* ss036.103 - Addition to handle the memory trampling return value
522 * This in turn can call SRegMemErrHdlr
524 #ifdef SSI_DEBUG_LEVEL1
525 if (ret == RTRAMPLINGNOK)
527 SRegMemErrHdlr( region, *ptr, ret);
529 #endif /* SSI_DEBUG_LEVEL1 */
539 * Desc: Frees a block of memory previously allocated by SAlloc().
542 * RFAILED - failed, general (optional)
549 /* ss001.301: Additions */
550 #ifdef SS_HISTOGRAM_SUPPORT
553 Region region, /* region ID */
554 Data *ptr, /* pointer to the allocated block */
555 Size size, /* size of block */
561 #ifdef T2K_MEM_LEAK_DBG
564 Region region, /* region ID */
565 Data *ptr, /* pointer to the allocated block */
566 Size size, /* size of block */
573 Region region, /* region ID */
574 Data *ptr, /* pointer to the allocated block */
575 Size size /* size of block */
582 /* ss001.301: Additions */
583 #ifdef SS_HISTOGRAM_SUPPORT
585 #endif /* SS_HISTOGRAM_SUPPORT */
589 /* Get the region which is assgined with this thread. The region was
590 * stored in the osCp and is taken with respect to thread ID. This macro
591 * is used only when SS_LOCKLESS_MEMORY flag is used and it overwrites
594 #ifdef XEON_SPECIFIC_CHANGES
597 region = SS_GET_THREAD_MEM_REGION();
600 #if (ERRCLASS & ERRCLS_INT_PAR)
601 /* validate region ID */
602 if (region >= SS_MAX_REGS)
604 SSLOGERROR(ERRCLS_INT_PAR, ESS040, region, "Invalid region");
608 /* ss021.103 - Addition to validate size and ptr */
611 SSLOGERROR(ERRCLS_INT_PAR, ESS041, region, "Invalid size");
616 if (ptr == (Data *)NULLP)
618 SSLOGERROR(ERRCLS_INT_PAR, ESS042, region, "Invalid ptr");
623 /* ss037.103 Removed the semaphore operation for performance enhancement */
626 /* acquire one semaphore, to protect against deregistration */
627 SS_ACQUIRE_SEMA(&osCp.regionTblSem, ret);
631 #if (ERRCLASS & ERRCLS_DEBUG)
632 SSLOGERROR(ERRCLS_DEBUG, ESS043, (ErrVal) ret,
633 "Could not lock region table");
639 #if (ERRCLASS & ERRCLS_INT_PAR)
640 /* verify that this region is around */
641 if (osCp.regionTbl[region].used == FALSE)
644 /* ss006.13: addition */
645 if( SS_RELEASE_SEMA(&osCp.regionTblSem) != ROK)
647 #if (ERRCLASS & ERRCLS_DEBUG)
648 SSLOGERROR(ERRCLS_DEBUG, ESS044, ERRZERO,
649 "Could not release the semaphore");
654 SSLOGERROR(ERRCLS_INT_PAR, ESS045, region, "Region not registered");
659 /* ss001.301: Additions */
660 #ifdef SS_HISTOGRAM_SUPPORT
661 SGetHstGrmInfo(&entId, &hstReg);
663 /* call the memory manager to free this memory */
664 ret = (osCp.regionTbl[region].free)
665 (osCp.regionTbl[region].regCb, ptr, size, line, fileName,
670 /* call the memory manager to free this memory */
671 #ifdef SS_LOCKLESS_MEMORY
672 #ifdef T2K_MEM_LEAK_DBG
673 ret = (osCp.dynRegionTbl[region].free)(osCp.dynRegionTbl[region].regCb, ptr, size,file,line);
675 ret = (osCp.dynRegionTbl[region].free)(osCp.dynRegionTbl[region].regCb, ptr, size);
678 #ifdef T2K_MEM_LEAK_DBG
679 ret = (osCp.regionTbl[region].free)(osCp.regionTbl[region].regCb, ptr, size,file,line);
681 ret = (osCp.regionTbl[region].free)(osCp.regionTbl[region].regCb, ptr, size);
683 #endif /* SS_LOCKLESS_MEMORY */
685 #endif /* SS_HISTOGRAM_SUPPORT */
687 /* ss037.103 Removed the semaphore operation for performance enhancement */
690 /* release the semaphore we took */
691 /* ss006.13: addition */
692 if( SS_RELEASE_SEMA(&osCp.regionTblSem) != ROK)
694 #if (ERRCLASS & ERRCLS_DEBUG)
695 SSLOGERROR(ERRCLS_DEBUG, ESS046, ERRZERO,
696 "Could not release the semaphore");
701 /* ss036.103 - changes to handle double free and trmapling return values
702 * This in turn may invoke SRegMemErrHdlr
704 #ifdef SSI_DEBUG_LEVEL1
705 /* handle the double free error here by calling the OS specific error handling function */
706 if ((ret == RDBLFREE) || (ret == RTRAMPLINGNOK))
708 SRegMemErrHdlr( region, ptr, ret);
710 #endif /* SSI_DEBUG_LEVEL1 */
717 /* ss001.301: Additions */
718 #ifdef SS_HISTOGRAM_SUPPORT
722 * Fun: SHstGrmInfoShow
724 * Desc: This function displays the memory usage information
725 * per Tapa task, which are registerd during initialization.
731 * Notes: A Sample Output from the function
732 * Memory Histogram for the Tapa task = (Entity Id)117
733 * ------Region Id = 0-------
734 * -----------Bucket Id = 0-----------
736 * File Name| Line | Bucket Alloc | Bytes Allocated | Bytes Wasted | Buckets Freed|Bytes Freed|
737 * lhi.c | 413 | 4 | 512 | 224 | 0 | 0 |
738 * hi_acc1.c| 333 | 0 | 0 | 0 | 2 | 256 |
739 * hi_acc1.c| 209 | 13 | 1664 | 728 | 0 | 0 |
749 /*ss012.301 : Increased Buffer size to fix segmentation fault*/
750 Txt prntBuf[511]; /* Buffer to print on the console */
751 uint16_t ret = ROK; /* return value */
752 Ent tapaTsk[SS_MAX_TTSKS]; /* List of tapa task */
753 uint32_t tskCnt = 0; /* Tapa task Count */
754 uint32_t regCnt = 0; /* Region count */
755 uint32_t bktCnt = 0; /* Bucket count in each region */
756 CmHstGrmHashListCp *hashListCp = NULLP; /* Hash List ponter of bucket */
759 CmMemEntries *entry = NULLP;
760 uint32_t blkSize = 0;
763 memset(tapaTsk, ENTNC, sizeof(tapaTsk));
767 /* If user is not asking for specific entity id then,
768 * Take Tapa task entity id from the osCp structure and
769 * print the histogram for all tapa task */
770 ret = SGetTapaTskEntIds(tapaTsk);
774 /* If user asked for specific tapa task then print histogram
775 * for those tapa task */
776 for(tskCnt = 0; entId[tskCnt]; tskCnt++)
778 tapaTsk[tskCnt] = entId[tskCnt];
781 for (tskCnt = 0; tapaTsk[tskCnt] != ENTNC; tskCnt++)
783 sprintf(prntBuf, "\n\nMemory Histogram for the Tapa task = (Entity Id)%d\n", tapaTsk[tskCnt]);
785 for (regCnt = 0; regCnt < osCp.numRegions; regCnt++)
788 CmMmRegCb* regCb = (CmMmRegCb*)osCp.regionTbl[regCnt].regCb;
790 sprintf(prntBuf, "------Region Id = %d-------\n", regCb->region);
792 for (bktCnt = 0; bktCnt < regCb->numBkts; bktCnt++)
794 /* ss002.301 - Compilation fixes */
795 /*ss013.301 Fix for compilation warnings 32/64 bit */
797 sprintf(prntBuf, "-----------Bucket Id = %u-----------\n\n", bktCnt);
799 sprintf(prntBuf, "-----------Bucket Id = %lu-----------\n\n", bktCnt);
802 sprintf(prntBuf, "File Name | Line | Bucket Alloc | Bytes Allocated | Bytes Wasted | Buckets Freed|Bytes Freed|\n");
804 hashListCp = &(regCb->bktTbl[bktCnt].hstGrmHashListCp);
805 blkSize = regCb->bktTbl[bktCnt].size;
806 for(binCnt = 0; binCnt < CMM_HIST_MAX_MEM_BIN; binCnt++)
808 for (entCnt = 0; entCnt < hashListCp->hashList[binCnt].numOfEntries; entCnt++)
810 entry = &(hashListCp->hashList[binCnt].entries[entCnt]);
811 if(entry->entId == tapaTsk[tskCnt])
813 /* ss002.301 - Compilation fixes */
814 /*ss013.301 Fix for compilation warnings 32/64 bit */
817 "%-18s|%7u |%13u |%16u |%13u |%13u |%10u |\n",
818 entry->fileName, entry->line, entry->bucketAllocReq,
819 (blkSize*entry->bucketAllocReq), entry->wastedBytes,
820 entry->bucketFreeReq, (blkSize*entry->bucketFreeReq));
823 "%-18s|%7lu |%13lu |%16lu |%13lu |%13lu |%10lu |\n",
824 entry->fileName, entry->line, entry->bucketAllocReq,
825 (blkSize*entry->bucketAllocReq), entry->wastedBytes,
826 entry->bucketFreeReq, (blkSize*entry->bucketFreeReq));
830 }/* end of for. Entry count */
831 } /* End of for. Hash bin count */
834 sprintf(prntBuf, "\n\n----------- Heap blocks -----------\n\n");
836 sprintf(prntBuf, "File Name | Line | Heap Allocs | Bytes Allocated | Bytes Wasted | Heap Frees |Bytes Freed|\n");
838 hashListCp = &(regCb->heapCb.heapHstGrmHashListCp);
839 for(binCnt = 0; binCnt < CMM_HIST_MAX_MEM_BIN; binCnt++)
841 for (entCnt = 0; entCnt < hashListCp->hashList[binCnt].numOfEntries; entCnt++)
843 entry = &(hashListCp->hashList[binCnt].entries[entCnt]);
844 if(entry->entId == tapaTsk[tskCnt])
846 /* ss002.301 - Compilation fixes */
847 /*ss013.301 Fix for compilation warnings 32/64 bit */
850 "%-18s|%7u |%13u |%16u |%13u |%13u |%10u |\n",
851 entry->fileName, entry->line, entry->bucketAllocReq,
852 entry->allocBytes, entry->wastedBytes,
853 entry->bucketFreeReq, entry->freedBytes);
856 "%-18s|%7lu |%13lu |%16lu |%13lu |%13lu |%10lu |\n",
857 entry->fileName, entry->line, entry->bucketAllocReq,
858 entry->allocBytes, entry->wastedBytes,
859 entry->bucketFreeReq, entry->freedBytes);
863 }/* end of for. Entry count */
864 } /* End of for. Hash bin count */
865 }/* End of for. Region Count */
866 } /* End of for (Tapa task)*/
869 /* Print the memory information used at common, sample and ssi files.
870 we considerd common Sample file as invalid entity id. */
871 sprintf(prntBuf, "\n\nMemory Histogram for the Tapa task = (Entity Id = ENTNC)%d\n", ENTNC);
873 for (regCnt = 0; regCnt < osCp.numRegions; regCnt++)
875 CmMmRegCb* regCb = (CmMmRegCb*)osCp.regionTbl[regCnt].regCb;
877 sprintf(prntBuf, "------Region Id = %d-------\n", regCb->region);
879 for (bktCnt = 0; bktCnt < regCb->numBkts; bktCnt++)
881 /* ss002.301 - Compilation fixes */
882 /*ss013.301 Fix for compilation warnings 32/64 bit */
884 sprintf(prntBuf, "-----------Bucket Id = %u-----------\n\n", bktCnt);
886 sprintf(prntBuf, "-----------Bucket Id = %lu-----------\n\n", bktCnt);
889 sprintf(prntBuf, "File Name | Line | Bucket Alloc | Bytes Allocated | Bytes Wasted | Buckets Freed|Bytes Freed|\n");
891 hashListCp = &(regCb->bktTbl[bktCnt].hstGrmHashListCp);
892 blkSize = regCb->bktTbl[bktCnt].size;
893 for(binCnt = 0; binCnt < CMM_HIST_MAX_MEM_BIN; binCnt++)
895 for (entCnt = 0; entCnt < hashListCp->hashList[binCnt].numOfEntries; entCnt++)
897 entry = &(hashListCp->hashList[binCnt].entries[entCnt]);
898 if(entry->entId == tapaTsk[tskCnt])
900 /* ss002.301 - Compilation fixes */
901 /*ss013.301 Fix for compilation warnings 32/64 bit */
903 sprintf(prntBuf, "%-18s|%7u |%13u |%16u |%13u |%13u |%10u |\n",
904 entry->fileName, entry->line, entry->bucketAllocReq, (blkSize*entry->bucketAllocReq),
905 entry->wastedBytes, entry->bucketFreeReq, (blkSize*entry->bucketFreeReq));
907 sprintf(prntBuf, "%-18s|%7lu |%13lu |%16lu |%13lu |%13lu |%10lu |\n",
908 entry->fileName, entry->line, entry->bucketAllocReq, (blkSize*entry->bucketAllocReq),
909 entry->wastedBytes, entry->bucketFreeReq, (blkSize*entry->bucketFreeReq));
913 }/* end of for. Entry count */
914 } /* End of for. Hash bin count */
916 }/* End of for. Bucket Count */
918 sprintf(prntBuf, "\n\n----------- Heap blocks -----------\n\n");
920 sprintf(prntBuf, "File Name | Line | Heap Allocs | Bytes Allocated | Bytes Wasted | Heap Frees |Bytes Freed|\n");
922 hashListCp = &(regCb->heapCb.heapHstGrmHashListCp);
923 for(binCnt = 0; binCnt < CMM_HIST_MAX_MEM_BIN; binCnt++)
925 for (entCnt = 0; entCnt < hashListCp->hashList[binCnt].numOfEntries; entCnt++)
927 entry = &(hashListCp->hashList[binCnt].entries[entCnt]);
928 if(entry->entId == tapaTsk[tskCnt])
930 /* ss002.301 - Compilation fixes */
931 /*ss013.301 Fix for compilation warnings 32/64 bit */
934 "%-18s|%7u |%13u |%16u |%13u |%13u |%10u |\n",
935 entry->fileName, entry->line, entry->bucketAllocReq,
936 entry->allocBytes, entry->wastedBytes,
937 entry->bucketFreeReq, entry->freedBytes);
940 "%-18s|%7lu |%13lu |%16lu |%13lu |%13lu |%10lu |\n",
941 entry->fileName, entry->line, entry->bucketAllocReq,
942 entry->allocBytes, entry->wastedBytes,
943 entry->bucketFreeReq, entry->freedBytes);
947 }/* end of for. Entry count */
948 } /* End of for. Hash bin count */
950 }/* End of for. Region Count */
955 #endif /* SS_HISTOGRAM_SUPPORT */
958 /**********************************************************************
960 **********************************************************************/