whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.18k stars 222 forks source link

Feature for export memory data #397

Closed zagaria closed 2 years ago

zagaria commented 2 years ago

Added code for use memory data as a table. I'm using this data as a metrics.

Tested on ESP32 WROVER over 2 weeks

zagaria commented 2 years ago

Hi @jolivepetrus,

Can you, please, review? These changes were tested on real device (ESP32 WROVER) over 2 weeks.

Thanks!

the0ne commented 2 years ago

Diff looks backwards compatible and makes sense 👍

zagaria commented 2 years ago

Hi @the0ne,

Is it possible to merge this?

Thanks!

the0ne commented 2 years ago

Yes I think so. Will try to review tomorrow.

the0ne commented 2 years ago

Style isn't really matching the existing code. Instead of your the many changes, you could just have added something like this, right? Or do I miss something here?

    } else if (stat && strcmp(stat,"table") == 0) {
        lua_createtable(L, 0, 0);

        lua_pushstring(L,"free");
        lua_pushinteger(L,xPortGetFreeHeapSize());
        lua_settable(L,-3);

        lua_pushstring(L,"min");
        lua_pushinteger(L,xPortGetMinimumEverFreeHeapSize());
        lua_settable(L,-3);

        return 1;
the0ne commented 2 years ago

Please reformat your patch to the above, test, and then submit a new PR. I will verify and merge it 👍🏻