Changeset 12705 in vbox
- Timestamp:
- Sep 24, 2008 8:52:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/VBoxDbgStatsQt4.cpp
r12673 r12705 231 231 static PDBGGUISTATSNODE createAndInsertNode(PDBGGUISTATSNODE pParent, const char *pszName, size_t cchName, uint32_t iPosition = UINT32_MAX); 232 232 233 static void resetNode(PDBGGUISTATSNODE pNode); 234 static void updateNode(PDBGGUISTATSNODE pNode, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit, 235 STAMVISIBILITY enmVisibility, const char *pszDesc, void *pvUser); 236 static int32_t getNodePath(PCDBGGUISTATSNODE pNode, char *psz, ssize_t cch); 237 static bool isNodeAncestorOf(PCDBGGUISTATSNODE pNode, PCDBGGUISTATSNODE pAncestor); 238 static PDBGGUISTATSNODE nextNode(PDBGGUISTATSNODE pNode); 239 static PDBGGUISTATSNODE prevNode(PDBGGUISTATSNODE pNode); 240 static void removeAndDeleteNode(PDBGGUISTATSNODE pNode); 241 233 242 /** 234 243 * Destroys a statistics tree. … … 713 722 714 723 return pNode; 724 } 725 726 727 /*static*/ void 728 VBoxDbgStatsModel::removeAndDeleteNode(PDBGGUISTATSNODE pNode) 729 { 730 /* frees stuff up */ 731 resetNode(pNode); 732 733 } 734 735 736 /*static*/ void 737 VBoxDbgStatsModel::resetNode(PDBGGUISTATSNODE pNode) 738 { 739 /** @todo */ 740 } 741 742 743 /*static*/ void 744 VBoxDbgStatsModel::updateNode(PDBGGUISTATSNODE pNode, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit, 745 STAMVISIBILITY enmVisibility, const char *pszDesc, void *pvUser) 746 { 747 /** @todo */ 748 } 749 750 751 /*static*/ int32_t 752 VBoxDbgStatsModel::getNodePath(PCDBGGUISTATSNODE pNode, char *psz, ssize_t cch) 753 { 754 int32_t off; 755 if (!pNode->pParent) 756 { 757 /* root - don't add it's slash! */ 758 AssertReturn(cch >= 1, -1); 759 off = 0; 760 *psz = '\0'; 761 } 762 else 763 { 764 cch -= pNode->cchName - 1; 765 AssertReturn(cch > 0, -1); 766 off = getNodePath(pNode->pParent, psz, cch); 767 if (off >= 0) 768 { 769 psz[off++] = '/'; 770 memcpy(&psz[off], pNode->pszName, pNode->cchName + 1); 771 off += pNode->cchName; 772 } 773 } 774 return off; 775 } 776 777 778 /*static*/ bool 779 VBoxDbgStatsModel::isNodeAncestorOf(PCDBGGUISTATSNODE pNode, PCDBGGUISTATSNODE pAncestor) 780 { 781 while (pNode) 782 { 783 pNode = pNode->pParent; 784 if (pNode == pAncestor) 785 return true; 786 } 787 return false; 788 } 789 790 791 /*static*/ PDBGGUISTATSNODE 792 VBoxDbgStatsModel::nextNode(PDBGGUISTATSNODE pNode) 793 { 794 if (!pNode) 795 return NULL; 796 797 /* decend to children. */ 798 if (pNode->cChildren) 799 return pNode->papChildren[0]; 800 801 PDBGGUISTATSNODE pParent = pNode->pParent; 802 if (!pParent) 803 return NULL; 804 805 /* next sibling. */ 806 if (pNode->iSelf + 1 < pNode->pParent->cChildren) 807 return pParent->papChildren[pNode->iSelf + 1]; 808 809 /* ascend and advanced to a parent's sibiling. */ 810 for (;;) 811 { 812 uint32_t iSelf = pParent->iSelf; 813 pParent = pParent->pParent; 814 if (!pParent) 815 return NULL; 816 if (iSelf + 1 < pParent->cChildren) 817 return pParent->papChildren[iSelf + 1]; 818 } 819 } 820 821 822 /*static*/ PDBGGUISTATSNODE 823 VBoxDbgStatsModel::prevNode(PDBGGUISTATSNODE pNode) 824 { 825 if (!pNode) 826 return NULL; 827 PDBGGUISTATSNODE pParent = pNode->pParent; 828 if (!pParent) 829 return NULL; 830 831 /* previous sibling's grand-most child (better expression anyone?). */ 832 if (pNode->iSelf > 0) 833 { 834 pNode = pParent->papChildren[pNode->iSelf - 1]; 835 while (pNode->cChildren) 836 pNode = pNode->papChildren[pNode->cChildren - 1]; 837 return pNode; 838 } 839 840 /* ascend to the parent (if any). */ 841 return pNode->pParent; 715 842 } 716 843 … … 1077 1204 } 1078 1205 1079 1080 1206 /*static*/ void 1081 1207 VBoxDbgStatsModel::stringifyNodeNoRecursion(PDBGGUISTATSNODE a_pNode, QString &a_rString) … … 1152 1278 1153 1279 1280 1281 1282 1154 1283 /* 1155 1284 * … … 1180 1309 /* nothing to do here. */ 1181 1310 } 1182 1183 1184 static void resetNode(PDBGGUISTATSNODE pNode)1185 {1186 /** @todo */1187 }1188 1189 static void updateNode(PDBGGUISTATSNODE pNode, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,1190 STAMVISIBILITY enmVisibility, const char *pszDesc, void *pvUser)1191 {1192 /** @todo */1193 }1194 1195 static int32_t getNodePath(PCDBGGUISTATSNODE pNode, char *psz, ssize_t cch)1196 {1197 int32_t off;1198 if (!pNode->pParent)1199 {1200 /* root - don't add it's slash! */1201 AssertReturn(cch >= 1, -1);1202 off = 0;1203 *psz = '\0';1204 }1205 else1206 {1207 cch -= pNode->cchName - 1;1208 AssertReturn(cch > 0, -1);1209 off = getNodePath(pNode->pParent, psz, cch);1210 if (off >= 0)1211 {1212 psz[off++] = '/';1213 memcpy(&psz[off], pNode->pszName, pNode->cchName + 1);1214 off += pNode->cchName;1215 }1216 }1217 return off;1218 }1219 1220 static bool isNodeAncestorOf(PCDBGGUISTATSNODE pNode, PCDBGGUISTATSNODE pAncestor)1221 {1222 while (pNode)1223 {1224 pNode = pNode->pParent;1225 if (pNode == pAncestor)1226 return true;1227 }1228 return false;1229 }1230 1231 static PDBGGUISTATSNODE nextNode(PDBGGUISTATSNODE pNode)1232 {1233 if (!pNode)1234 /* done */;1235 /* decend to children. */1236 else if (pNode->cChildren)1237 pNode = pNode->papChildren[0];1238 else1239 {1240 PDBGGUISTATSNODE pParent = pNode->pParent;1241 if (!pParent)1242 pNode = NULL;1243 /* next sibling. */1244 else if (pNode->iSelf + 1 < pNode->pParent->cChildren)1245 pNode = pParent->papChildren[pNode->iSelf + 1];1246 /* ascend and advanced to a parent's sibiling. */1247 else1248 {1249 for (;;)1250 {1251 uint32_t iSelf = pParent->iSelf;1252 pParent = pParent->pParent;1253 if (!pParent)1254 {1255 pNode = NULL;1256 break;1257 }1258 if (iSelf + 1 < pParent->cChildren)1259 {1260 pNode = pParent->papChildren[iSelf + 1];1261 break;1262 }1263 }1264 }1265 }1266 1267 return pNode;1268 }1269 1270 static PDBGGUISTATSNODE prevNode(PDBGGUISTATSNODE pNode)1271 {1272 /** @todo */1273 return pNode;1274 }1275 1276 static void removeAndDeleteNode(PDBGGUISTATSNODE pNode)1277 {1278 /** @todo */1279 1280 }1281 1282 1311 1283 1312 /*static*/ DECLCALLBACK(int)
Note:
See TracChangeset
for help on using the changeset viewer.