Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-2512

wtperf: MSVC complains about float conversion in throttle code

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.9.0
    • Labels:
      None

      Description

      David Hows, in wtperf/wtperf_throttle.c, there's this code:

      throttle_cfg->ops_count =
          (uint64_t) (float)(usecs_delta /
          throttle_cfg->usecs_increment) *
          (float)throttle_cfg->ops_per_increment;
      throttle_cfg->last_increment = now;
      

      and MSVC complains:

      bench\wtperf\wtperf_throttle.c(110): warning C4244: '=': conversion from
      'float' to 'uint64_t', possible loss of data
      

      I'm not sure what's going on here – all of the fields are uint64_t, not sure why we're casting everything to float, couldn't we get the same results using an integer expression?

      I suspect the warning would go away if we just cast the result of the calculation to uint64_t, but I don't really understand what's going on here.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                david.hows David Hows (Inactive)
                Reporter:
                keith.bostic Keith Bostic
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: