OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2009 NVIDIA Corporation. |
| 3 * All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: |
| 7 * |
| 8 * Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. |
| 10 * |
| 11 * Redistributions in binary form must reproduce the above copyright notice, |
| 12 * this list of conditions and the following disclaimer in the documentation |
| 13 * and/or other materials provided with the distribution. |
| 14 * |
| 15 * Neither the name of the NVIDIA Corporation nor the names of its contributors |
| 16 * may be used to endorse or promote products derived from this software |
| 17 * without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 * POSSIBILITY OF SUCH DAMAGE. |
| 30 * |
| 31 */ |
| 32 |
| 33 #ifndef INCLUDED_nvrm_memctrl_H |
| 34 #define INCLUDED_nvrm_memctrl_H |
| 35 |
| 36 |
| 37 #if defined(__cplusplus) |
| 38 extern "C" |
| 39 { |
| 40 #endif |
| 41 |
| 42 #include "nvrm_module.h" |
| 43 #include "nvrm_init.h" |
| 44 |
| 45 #include "nvcommon.h" |
| 46 #include "nvassert.h" |
| 47 #include "nvos.h" |
| 48 |
| 49 /* |
| 50 * @ingroup nvrm_memctrl |
| 51 * @{ |
| 52 */ |
| 53 |
| 54 /** |
| 55 * NvRmDeviceHandle is an opaque handle to an RM device. |
| 56 */ |
| 57 |
| 58 /** |
| 59 * Start collecting statistics for specified clients. (2 normal clients and 1 ll
c client) |
| 60 * |
| 61 * @param rm the RM handle is stored here. |
| 62 * @param client_id_0 the ID of the first client |
| 63 * @param client_id_1 the ID of the second client |
| 64 * @param llc_client_id the ID of the llc client |
| 65 * |
| 66 */ |
| 67 |
| 68 void McStat_Start( |
| 69 NvRmDeviceHandle rm, |
| 70 NvU32 client_id_0, |
| 71 NvU32 client_id_1, |
| 72 NvU32 llc_client_id ); |
| 73 |
| 74 /** |
| 75 * Stop the counter for collecting statistics for specified clinets |
| 76 * @param rm the RM handle is stored here |
| 77 * @param client_0_cycles pointer to the number of cycles of client_0 |
| 78 * @param client_1_cycles pointer to the number of cycles of client_1 |
| 79 * @param llc_client_cycles pointer to the number of cycles of llc client |
| 80 * @param llc_client_clocks pointer to the llc client's clock |
| 81 * @param mc_clocks pointer to the memory controller's clock |
| 82 */ |
| 83 |
| 84 void McStat_Stop( |
| 85 NvRmDeviceHandle rm, |
| 86 NvU32 * client_0_cycles, |
| 87 NvU32 * client_1_cycles, |
| 88 NvU32 * llc_client_cycles, |
| 89 NvU32 * llc_client_clocks, |
| 90 NvU32 * mc_clocks ); |
| 91 |
| 92 /** |
| 93 * Print out the collected memory control stat data |
| 94 * @param client_id_0 the first client's ID |
| 95 * @param client_0_cycles the number of cycles of client_0 from start to stop |
| 96 * @param client_id_1 the second client's ID |
| 97 * @param client_1_cycles the number of cycles of client_1 from start to stop |
| 98 * @param llc_client_id the ID of llc client |
| 99 * @param llc_client_clocks the clocks of llc client |
| 100 * @param llc_client_cycles the number of cycles of llc client |
| 101 * @param mc_clocks the memory controller's clock |
| 102 */ |
| 103 |
| 104 void McStat_Report( |
| 105 NvU32 client_id_0, |
| 106 NvU32 client_0_cycles, |
| 107 NvU32 client_id_1, |
| 108 NvU32 client_1_cycles, |
| 109 NvU32 llc_client_id, |
| 110 NvU32 llc_client_clocks, |
| 111 NvU32 llc_client_cycles, |
| 112 NvU32 mc_clocks ); |
| 113 |
| 114 /** |
| 115 * Read the data of specified module and bit field |
| 116 * @param modId the specified module ID |
| 117 * @param start_index the start index of the required data |
| 118 * @param length the length of the data |
| 119 * @param value pointer to the variable that will store the data specified |
| 120 * |
| 121 * @retval NvSuccess Indicate the the data is read successfully |
| 122 */ |
| 123 |
| 124 NvError ReadObsData( |
| 125 NvRmDeviceHandle rm, |
| 126 NvRmModuleID modId, |
| 127 NvU32 start_index, |
| 128 NvU32 length, |
| 129 NvU32 * value ); |
| 130 |
| 131 /** |
| 132 * Starts CPU performance monitors for the specified list of events |
| 133 * (if monitors were already running they are restarted). |
| 134 * |
| 135 * @param hRmDevice The RM device handle. |
| 136 * @param pEventListSize Pointer to the event list size. On entry specifies |
| 137 * list size allocated by the client, on exit - actual number of event monitors |
| 138 * started. If entry size is 0, maximum number of monitored events is returned. |
| 139 * @param pEventList Pointer to the list of events to be monitored. Ignored |
| 140 * if input list size is 0. Monitors run status is not affected in this case. |
| 141 * |
| 142 * @note No event validation is performed. It is caller responsibility to pass |
| 143 * valid event codes. See ARM control coprocessor CP15 specification for the |
| 144 * list of event numbers and the respective event definitions. |
| 145 * |
| 146 * @retval NvSuccess if monitoring start function completed successfully. |
| 147 * @retval NvError_NotSupported if core performance monitoring is not supported. |
| 148 */ |
| 149 |
| 150 NvError NvRmCorePerfMonStart( |
| 151 NvRmDeviceHandle hRmDevice, |
| 152 NvU32 * pEventListSize, |
| 153 NvU32 * pEventList ); |
| 154 |
| 155 /** |
| 156 * Stops CPU performance monitors and returns event counts. |
| 157 * |
| 158 * @param hRmDevice The RM device handle. |
| 159 * @param pCountListSize Pointer to the count list size. On entry specifies |
| 160 * list size allocated by the client, on exit - actual number of event counts |
| 161 * returned. |
| 162 * @param pCountList Pointer to the list filled in by this function with event |
| 163 * counts since performance monitoring started. The order of returned counts |
| 164 * is the same as the order of events specified by NvRmCorePerfMonStart() |
| 165 * call. If input list size exceeds number of started event monitors the extra |
| 166 * counts are meaningless. If input list size is 0, this parameter is ignored, |
| 167 * and no event counts are returned. |
| 168 * @param pTotalCycleCount Pointer to the total number of CPU clock cycles |
| 169 * since performance monitoring started. |
| 170 * |
| 171 * @retval NvSuccess if monitoring results are retrieved successfully. |
| 172 * @retval NvError_InvalidState if core performance monitoring has not been |
| 173 * started or monitor overflow has occurred. |
| 174 * @retval NvError_NotSupported if core performance monitoring is not supported. |
| 175 */ |
| 176 |
| 177 NvError NvRmCorePerfMonStop( |
| 178 NvRmDeviceHandle hRmDevice, |
| 179 NvU32 * pCountListSize, |
| 180 NvU32 * pCountList, |
| 181 NvU32 * pTotalCycleCount ); |
| 182 |
| 183 /** @} */ |
| 184 |
| 185 #if defined(__cplusplus) |
| 186 } |
| 187 #endif |
| 188 |
| 189 #endif |
OLD | NEW |