<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4: Code-Review+1</p><p style="white-space: pre-wrap; word-wrap: break-word;">(1 comment)</p></blockquote><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11351">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/11351/4/res/prometheus/channels.c">File res/prometheus/channels.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/11351/4/res/prometheus/channels.c@174">Patch Set #4, Line 174:</a> <code style="font-family:monospace,monospace"></code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Can you reverse the order of these "for" loops so you don't have to traverse the potentially large c […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Thinking through this (I'm finding I have to type this to think through what the suggestion will do...)</p><p style="white-space: pre-wrap; word-wrap: break-word;">Right now, we have a large array of metrics, where each grouping of metrics are contiguous within the array. Each group maintains a linked list between the related metrics within the family, making it look something like this:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">[ metric_1_channel_1 | metric_1_channel_2 | metric_2_channel_1 | metric_2_channel_2 ]<br> root ---------------> child root ----------------> child</pre><p style="white-space: pre-wrap; word-wrap: break-word;">Because printing a metric walks all the children, we have to 'skip' through the array, which we do based on the metric families:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">[ metric_1_channel_1 | metric_1_channel_2 | metric_2_channel_1 | metric_2_channel_2 ]<br> ^ ^<br> print print</pre><p style="white-space: pre-wrap; word-wrap: break-word;">If we re-order it per your suggestion, that will do the following:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">[ metric_1_channel_1 | metric_2_channel_1 | metric_1_channel_2 | metric_2_channel_2 ]<br> root -------------------------------------> child<br> root ------------------------------------> child</pre><p style="white-space: pre-wrap; word-wrap: break-word;">For some reason I find that a bit harder to keep in my head when I'm thinking about it, but the code is probably just as clean as what exists today.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Printing it should be easy: just walk the first _n_ elements, where _n_ is the number of metrics.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I think this is doable.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11351">change 11351</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11351"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I0db306ec94205d4f58d1e7fbabfe04b185869f59 </div>
<div style="display:none"> Gerrit-Change-Number: 11351 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Matt Jordan <mjordan@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Matt Jordan <mjordan@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 21 May 2019 14:25:46 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>