socketstats: sort
This commit is contained in:
		
							parent
							
								
									f78e7d39ae
								
							
						
					
					
						commit
						9630f02275
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -227,7 +227,9 @@ socketstats.category = CATEGORY;
 | 
			
		|||
socketstats.helpText = "List the counts of socket events this session";
 | 
			
		||||
socketstats.callback = function () {
 | 
			
		||||
  let out = "```c\n";
 | 
			
		||||
  for (const [event, count] of Object.entries(hf.event_stats)) {
 | 
			
		||||
  const events = Object.entries(hf.event_stats);
 | 
			
		||||
  events.sort((a, b) => b[1] - a[1]);
 | 
			
		||||
  for (const [event, count] of events) {
 | 
			
		||||
    out += `"${event}": ${count}\n`;
 | 
			
		||||
  }
 | 
			
		||||
  out += "```";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue