Windows software to show computer's energy usage or battery discharge rate

39

Solution 1

At last, I have found a solution! Microsoft has a free Research Labs program called Joulemeter which estimates power usage of the overall system and various components:

Joulemeter is a software tool that estimates the power consumption of your computer. It tracks computer resources, such as CPU utilization and screen brightness, and estimates power usage.

On laptops it uses internal power-measuring circuitry which I presume is present in most computers. For desktop computers, it can make estimates or use an external power measuring device to calibrate itself.

Unfortunately, I ran into some errors with the automatic calibration on my laptop (possibly related to the fact that HP batteries don't provide as much battery usage data as other laptops do), but was able to calibrate it manually.

screenshot of joulemeter

I just found this and haven't had much time to play with it yet, but it looks like it'll do the job!

Solution 2

Code (in C):

#include <stdio.h>
#include <windows.h>
#include <powrprof.h>
#pragma comment(lib, "powrprof.lib")

int main(void)
{
    SYSTEM_BATTERY_STATE sbs = {0};
    CallNtPowerInformation(SystemBatteryState, NULL, 0, &sbs, sizeof(sbs));
    printf("Charge rate: %.1f W\n", (int)sbs.Rate / 1000.0);
    return 0;
}

Executable (base64; 1 KiB):

TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABX6uPGE4uNlROLjZUTi42V0ISClRKLjZUTi4yVEYuNldCE0JUWi42V0ITulRKLjZXQhNeVEouNlVJpY2gTi42VAAAAAAAAAABQRQAATAEBADJq1E4AAAAAAAAAAOAADwELAQcKAAIAAAAAAAAAAAAAMBAAAAAQAAAAIAAAAABAAAAQAAAAAgAABAAAAAAAAAAEAAAAAAAAAAAgAAAAAgAAAAAAAAMAAAQAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAAARAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC50ZXh0AAAAigEAAAAQAAAAAgAAAAIAAAAAAAAAAAAAAAAAACAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiEQAAAAAAAEwRAAAAAAAA/Knx0k1iUD8AAAAAAAAAAP8lABBAAMzMzMzMzMzMzMyD7DiycohUJAOIVCQHM9KJVCQZiVQkHYlUJCG4IAAAAFCJVCQpsWWIRCQKiEQkEIhEJBWJVCQtjUQkHFCITCQNiEwkEjPJiVQkNVGJVCQ9UWaJVCRFagXGRCQUQ8ZEJBVoxkQkFmHGRCQYZ8ZEJBxhxkQkHXTGRCQfOsZEJCElxkQkIi7GRCQjMcZEJCRmxkQkJlfGRCQnCohMJCiITCQsiFQkS+hH////20QkKIPsCI1MJAjcDRAQQADdHCRR/xUIEEAAM8CDxETDzMzMzMzM
RBEAAAAAAAAAAAAAVhEAAAgQAAA8EQAAAAAAAAAAAAB8EQAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYhEAAAAAAABMEQAAAAAAAPECcHJpbnRmAABtc3ZjcnQuZGxsAAAAAENhbGxOdFBvd2VySW5mb3JtYXRpb24AAFBPV1JQUk9GLmRsbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==

which can be decoded with online tools, e.g. this one.

Output:

Charge rate: -18.0 W

Of course, it's only querying the battery for the information, so its accuracy is entirely dependent on the battery's. :)

Solution 3

Now looking at the Battery Bar Features Page, it appears to give you capacity. You could try seeing how many mWh it goes down by each second or minute, and just do a little math.

Solution 4

I use BatteryCare and recommend because it has more features than BatteryBar (that I used before) for free.

It also shows ballon popups when charging and discharging, numeric info in notification area when discharging and some more info accessing them from its menu on tray.

Try that ;)

Share:
39
HelpMeOut
Author by

HelpMeOut

Updated on September 18, 2022

Comments

  • HelpMeOut
    HelpMeOut over 1 year

    i'm creating a ticketing system and i need some assistance. The code directly below displays the database records and the delete works fine. The edit however isn't working.

     <?Php
            require "config.php";           
    
            $page_name="currentout.php";  
            $start=$_GET['start'];
            if(strlen($start) > 0 and !is_numeric($start)){
            echo "Data Error";
            exit;
            }
    
    
            $eu = ($start - 0); 
            $limit = 10;                                 
            $this1 = $eu + $limit; 
            $back = $eu - $limit; 
            $next = $eu + $limit; 
    
            $nume = $dbo->query("select count(id) from receipt")->fetchColumn();
    
    
            echo "<TABLE class='t1'>";
            echo  "<tr><th>ID</th><th>Name</th><th>Pass</th><th>Amount</th><th>Action</th></tr>";
    
    
            $query=" SELECT * FROM receipt  limit $eu, $limit ";
    
    
            foreach ($dbo->query($query) as $row) {
    
            @$m=$i%2;
            @$i=$i+1;   
            echo "<tr class='r$m'><td>$row[id]</td><td>$row[name]</td><td>$row[phone_num]</td><td>$row[Amount]</td><td><a href='delete.php?id=$row[id]'>delete</a></td><td><a href='edit.php?id=$row[id]'>Edit</a></td></tr>";
            }
            echo "</table>";
    
            if($nume > $limit ){ 
            echo "<table align = 'center' width='50%'><tr><td  align='left' width='30%'>";
    
            if($back >=0) { 
            print "<a href='$page_name?start=$back'><font face='Verdana' size='2'>PREV</font></a>"; 
            } 
    
            echo "</td><td align=center width='30%'>";
            $i=0;
            $l=1;
            for($i=0;$i < $nume;$i=$i+$limit){
            if($i <> $eu){
            echo " <a href='$page_name?start=$i'><font face='Verdana' size='2'>$l</font></a> ";
            }
            else { echo "<font face='Verdana' size='4' color=red>$l</font>";}        
            $l=$l+1;
            }
    
    
            echo "</td><td  align='right' width='30%'>";
    
            if($this1 < $nume) { 
            print "<a href='$page_name?start=$next'><font face='Verdana' size='2'>NEXT</font></a>";} 
            echo "</td></tr></table>";
    
            } 
            ?>
    

    The code below is edit.php. It's supposed to display the various fields when clicked to allow for editing but it isn't picking any field. What i'm i missing?

    <?Php
    require "config.php";   
    $sql = "SELECT FROM receipt  WHERE ID=  :ID";
    
    $stmt = $dbo->prepare($sql);
    $stmt->bindParam(':ID', $_GET['id'], PDO::PARAM_INT);  
    $stmt->execute();
    ?>
    
        <form action="update.php" method="post" enctype="multipart/form-data">
        <table align="center">
       <tr>
       <td> <label><strong>Full Names</strong></label></td>
         <td> <input type='text' name='name' value=" <?php echo $row['name']; ?>"  />
          <input type="hidden" name="id" value="<?php echo $id; ?> " /> <br /></td>
        </tr>
        <tr>
    
         <td><label><strong>ID/Passport No. </strong></label></td>
      <td> <input type="text" name="pass" value="<?php echo $row['id_passno']; ?> " /><br /></td>
      </tr>
       <tr>
        <td> <label><strong>Phone No. </strong></label></td>
        <td><input type="text" name="phone" value="<?php echo $row['phone_num']; ?>" /> <br /></td>
        </tr>
        <tr>
    
        <td> <label><strong>Amount (KShs.) </strong></label></td>
        <td><input type="text" name="amount" value="<?php echo $row['Amount']; ?> "/> <br /></td>
       </tr>
        <tr>
      <td> 
              <input type="reset" name="Reset" value="CANCEL" onClick="return confirm('Discard changes?');" />
          <br></td>
    
    
         <td> 
              <input type="submit" name="Submit2" value="SUBMIT" />
          </td>
       </tr>
    </table>
    </form>
    
    • JJ_Australia
      JJ_Australia over 12 years
      Hm. Not sure if this is actually possible through software. If you don't find a solution, you could always go buy a Kill A Watt.
  • nhinkle
    nhinkle almost 13 years
    I can do this, and it sort of works, but I'd much prefer something with a live read-out. Battery Bar already does essentially this, but the problem is, it doesn't update very quickly.
  • Simon Sheehan
    Simon Sheehan almost 13 years
    I do not have it installed currently, but are there any settings to increase the update time?
  • nhinkle
    nhinkle almost 13 years
    possibly in the Pro version, but the Free version is not configurable in any way.
  • user541686
    user541686 over 12 years
    @nhinkle: Of course! Added it.
  • nhinkle
    nhinkle over 12 years
    Dang. It just returns Charge rate: 0.0 W for me... told you my battery circuitry is crap. Nifty little tool though; thanks for sharing!
  • user541686
    user541686 over 12 years
    @nhinkle: Aww darn. :( Sometimes it gives better info if you wait a little, idk. Yup, hopefully someone else will be able to use it. :)