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

wtperf: MSVC complains about float conversion in throttle code

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.9.0
    • Labels:
      None
    • # Replies:
      10
    • Last comment by Customer:
      true

      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.

        Issue Links

          Activity

          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'agorrod', u'name': u'Alex Gorrod', u'email': u'alexander.gorrod@mongodb.com'}

          Message: Merge pull request #2615 from wiredtiger/wt-2512

          WT-2512 - Change how wtperf throttle values per thread are calculated
          Branch: mongodb-3.4
          https://github.com/wiredtiger/wiredtiger/commit/3030f356cb8050b1e35ae01318a8b1c0fead9528

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'agorrod', u'name': u'Alex Gorrod', u'email': u'alexander.gorrod@mongodb.com'} Message: Merge pull request #2615 from wiredtiger/wt-2512 WT-2512 - Change how wtperf throttle values per thread are calculated Branch: mongodb-3.4 https://github.com/wiredtiger/wiredtiger/commit/3030f356cb8050b1e35ae01318a8b1c0fead9528
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'daveh86', u'name': u'David Hows', u'email': u'howsdav@gmail.com'}

          Message: WT-2512 - Change how throttle values per thread are calculated
          Branch: mongodb-3.2
          https://github.com/wiredtiger/wiredtiger/commit/219e5f179eb1a54a757bc77b2b5be33ef32239a2

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'daveh86', u'name': u'David Hows', u'email': u'howsdav@gmail.com'} Message: WT-2512 - Change how throttle values per thread are calculated Branch: mongodb-3.2 https://github.com/wiredtiger/wiredtiger/commit/219e5f179eb1a54a757bc77b2b5be33ef32239a2
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'daveh86', u'name': u'David Hows', u'email': u'howsdav@gmail.com'}

          Message: WT-2512 - Minor changes to make intent clearer.
          Branch: mongodb-3.2
          https://github.com/wiredtiger/wiredtiger/commit/b4f54c793fafb74819ee09ad25087e6fa914df2d

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'daveh86', u'name': u'David Hows', u'email': u'howsdav@gmail.com'} Message: WT-2512 - Minor changes to make intent clearer. Branch: mongodb-3.2 https://github.com/wiredtiger/wiredtiger/commit/b4f54c793fafb74819ee09ad25087e6fa914df2d
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'agorrod', u'name': u'Alex Gorrod', u'email': u'alexander.gorrod@mongodb.com'}

          Message: Merge pull request #2615 from wiredtiger/wt-2512

          WT-2512 - Change how wtperf throttle values per thread are calculated
          Branch: mongodb-3.2
          https://github.com/wiredtiger/wiredtiger/commit/3030f356cb8050b1e35ae01318a8b1c0fead9528

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'agorrod', u'name': u'Alex Gorrod', u'email': u'alexander.gorrod@mongodb.com'} Message: Merge pull request #2615 from wiredtiger/wt-2512 WT-2512 - Change how wtperf throttle values per thread are calculated Branch: mongodb-3.2 https://github.com/wiredtiger/wiredtiger/commit/3030f356cb8050b1e35ae01318a8b1c0fead9528
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'name': u'Ramon Fernandez', u'email': u'ramon@mongodb.com'}

          Message: Import wiredtiger-wiredtiger-2.8.0-201-g7ea2631.tar.gz from wiredtiger branch mongodb-3.2

          ref: 43e885a..7ea2631

          SERVER-23504 Coverity analysis defect 98177: Resource leak
          SERVER-23526 Replication relies on storage engines reporting a non-zero size for correctness
          SERVER-23588 mongod with WiredTiger won't start on Windows when built with --dbg=on --opt=off
          SERVER-23682 WiredTiger changes for MongoDB 3.2.6
          WT-2330 in-memory configurations should not create on-disk collection files
          WT-2507 Add upgrading documentation in preparation for 2.8 release.
          WT-2512 wtperf: MSVC complains about float conversion in throttle code
          WT-2513 conversion from 'int64_t' to 'uint32_t'
          WT-2517 wtperf uses setvbuf in a way that isn't supported on Windows
          WT-2522 Incorrect format code in message
          WT-2525 in-memory configurations: miscellaneous cleanups
          WT-2527 OS X compile error, missing POSIX_FADV_WILLNEED #define
          WT-2528 style error in WiredTiger build
          WT-2529 The readonly test case is crashing with a stack overflow
          WT-2531 in-memory tables are allocating unnecessary memory
          WT-2532 WT_STREAM_APPEND and WT_STREAM_LINE_BUFFER flag overlap
          WT-2533 Ensure that in-memory tables don't report a zero size
          WT-2534 Invalid transaction snapshots on PowerPC
          Branch: v3.2
          https://github.com/mongodb/mongo/commit/7ee4e4e493c3785fea489ee3508ca18526709c16

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'name': u'Ramon Fernandez', u'email': u'ramon@mongodb.com'} Message: Import wiredtiger-wiredtiger-2.8.0-201-g7ea2631.tar.gz from wiredtiger branch mongodb-3.2 ref: 43e885a..7ea2631 SERVER-23504 Coverity analysis defect 98177: Resource leak SERVER-23526 Replication relies on storage engines reporting a non-zero size for correctness SERVER-23588 mongod with WiredTiger won't start on Windows when built with --dbg=on --opt=off SERVER-23682 WiredTiger changes for MongoDB 3.2.6 WT-2330 in-memory configurations should not create on-disk collection files WT-2507 Add upgrading documentation in preparation for 2.8 release. WT-2512 wtperf: MSVC complains about float conversion in throttle code WT-2513 conversion from 'int64_t' to 'uint32_t' WT-2517 wtperf uses setvbuf in a way that isn't supported on Windows WT-2522 Incorrect format code in message WT-2525 in-memory configurations: miscellaneous cleanups WT-2527 OS X compile error, missing POSIX_FADV_WILLNEED #define WT-2528 style error in WiredTiger build WT-2529 The readonly test case is crashing with a stack overflow WT-2531 in-memory tables are allocating unnecessary memory WT-2532 WT_STREAM_APPEND and WT_STREAM_LINE_BUFFER flag overlap WT-2533 Ensure that in-memory tables don't report a zero size WT-2534 Invalid transaction snapshots on PowerPC Branch: v3.2 https://github.com/mongodb/mongo/commit/7ee4e4e493c3785fea489ee3508ca18526709c16

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                1 year, 5 weeks, 4 days ago
                Date of 1st Reply: