forked from tbnobody/OpenDTU
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: add heap details to system info and prometheus (#595)
this change adds the values of ESP.gteMaxAllocHeap() and ESP.getMinFreeHead() to the prometheus metrics and the system information object. the web UI uses these values to diplay the size of the largest free contiguous block, calculate a rough estimate for the level of fragmentation, and the maximum usage of heap memory since boot in absolute and relative amounts.
- Loading branch information
1 parent
3c8b8d4
commit 377406f
Showing
8 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
<CardElement :text="$t('heapdetails.HeapDetails')" textVariant="text-bg-primary"> | ||
<div class="table-responsive"> | ||
<table class="table table-hover table-condensed"> | ||
<tbody> | ||
<tr> | ||
<th>{{ $t('heapdetails.TotalFree') }}</th> | ||
<td>{{ $n(Math.round(getFreeHeap() / 1024), 'kilobyte') }}</td> | ||
</tr> | ||
<tr> | ||
<th>{{ $t('heapdetails.LargestFreeBlock') }}</th> | ||
<td>{{ $n(Math.round(systemStatus.heap_max_block / 1024), 'kilobyte') }}</td> | ||
</tr> | ||
<tr> | ||
<th>{{ $t('heapdetails.Fragmentation') }}</th> | ||
<td>{{ $n(getFragmentation(), 'percent') }}</td> | ||
</tr> | ||
<tr> | ||
<th>{{ $t('heapdetails.MaxUsage') }}</th> | ||
<td>{{ $n(Math.round(getMaxUsageAbs() / 1024), 'kilobyte') }} ({{ $n(getMaxUsageRel(), 'percent') }})</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</CardElement> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import CardElement from '@/components/CardElement.vue'; | ||
import type { SystemStatus } from '@/types/SystemStatus'; | ||
import { defineComponent, type PropType } from 'vue'; | ||
export default defineComponent({ | ||
components: { | ||
CardElement, | ||
}, | ||
props: { | ||
systemStatus: { type: Object as PropType<SystemStatus>, required: true }, | ||
}, | ||
methods: { | ||
getFreeHeap() { | ||
return this.systemStatus.heap_total - this.systemStatus.heap_used; | ||
}, | ||
getMaxUsageAbs() { | ||
return this.systemStatus.heap_total - this.systemStatus.heap_min_free; | ||
}, | ||
getMaxUsageRel() { | ||
return this.getMaxUsageAbs() / this.systemStatus.heap_total; | ||
}, | ||
getFragmentation() { | ||
return 1 - (this.systemStatus.heap_max_block / this.getFreeHeap()); | ||
}, | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters