当前位置: 首页>>代码示例>>C++>>正文


C++ SortedList::itemAt方法代码示例

本文整理汇总了C++中SortedList::itemAt方法的典型用法代码示例。如果您正苦于以下问题:C++ SortedList::itemAt方法的具体用法?C++ SortedList::itemAt怎么用?C++ SortedList::itemAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SortedList的用法示例。


在下文中一共展示了SortedList::itemAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dumpMemoryUsage

void TextureTracker::dumpMemoryUsage(String8 &log) {

    log.appendFormat("\nTextureTracker:\n");

    int sum = 0;
    SortedList<String8> list;
    size_t count = mMemoryList.size();
    for (size_t i = 0; i < count; i++) {
        const String8& current = mMemoryList.itemAt(i).mName;
        size_t tmp = list.size();
        bool found = false;
        for (size_t j = 0; j < tmp; j++) {
            if (current == list.itemAt(j)) {
                found = true;
                break;
            }
        }
        if (!found) {
            list.add(current);
        }
    }
    size_t tmp = list.size();

    for (size_t i = 0; i < tmp; i++) {
        const String8& current = list.itemAt(i);
        String8 tmpString;
        int tmpsum = 0;
        for (size_t j = 0; j < count; j++) {
            const TextureEntry& entry = mMemoryList.itemAt(j);
            if (entry.mName == current) {
                String8 format;
                String8 type;
                char s[64];

                switch (entry.mFormat) {
                case GL_RGBA:
                    format = String8("GL_RGBA");
                    break;
                case GL_RGB:
                    format = String8("GL_RGB");
                    break;
                case GL_ALPHA:
                    format = String8("GL_ALPHA");
                    break;
                case GL_LUMINANCE:
                    format = String8("GL_LUMINANCE");
                    break;
                case GL_LUMINANCE_ALPHA:
                    format = String8("GL_LUMINANCE_ALPHA");
                    break;
                default:
                    sprintf(s, "0x%x", entry.mFormat);
                    format = String8(s);
                    break;
                }

                switch (entry.mType) {
                case GL_UNSIGNED_BYTE:
                    type = String8("GL_UNSIGNED_BYTE");
                    break;
                case GL_UNSIGNED_SHORT_4_4_4_4:
                    type = String8("GL_UNSIGNED_SHORT_4_4_4_4");
                    break;
                case GL_UNSIGNED_SHORT_5_5_5_1:
                    type = String8("GL_UNSIGNED_SHORT_5_5_5_1");
                    break;
                case GL_UNSIGNED_SHORT_5_6_5:
                    type = String8("GL_UNSIGNED_SHORT_5_6_5");
                    break;
                case GL_FLOAT:
                    type = String8("GL_FLOAT");
                    break;
                default:
                    sprintf(s, "0x%x", entry.mType);
                    type = String8(s);
                    break;
                }

                tmpString.appendFormat("        %d (%d, %d) (%s, %s) %d <%s> %s\n", entry.mId, entry.mWidth,
                                       entry.mHeight, format.string(), type.string(), entry.mMemory,
                                       entry.mPurpose.string(), entry.mGhost ? "g" : "");
                tmpsum += entry.mMemory;
            }
        }

        sum += tmpsum;
        log.appendFormat("%s: %d bytes, %.2f KB, %.2f MB\n", current.string(), tmpsum, tmpsum / 1024.0f, tmpsum / 1048576.0f);
        log.append(tmpString);
        log.append("\n");
    }


    int rss = load3dUsage();
    log.appendFormat("\nTotal monitored:\n  %d bytes, %.2f KB, %.2f MB\n", sum, sum / 1024.0f, sum / 1048576.0f);
//     log.appendFormat("Physical allocated:\n  %d bytes, %.2f KB, %.2f MB\n", rss, rss / 1024.0f, rss / 1048576.0f);
//     log.appendFormat("Coverage rate:\n  %.2f %%\n", 100 * ((float)sum) / rss);


}
开发者ID:ferhung,项目名称:p201-mediatek,代码行数:99,代码来源:MTKDebug.cpp


注:本文中的SortedList::itemAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。