Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Who was that Affinity Masked Man?


Who was that Affinity Masked Man?

Author
Message
SQLBOT
SQLBOT
SSChasing Mays
SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)

Group: General Forum Members
Points: 660 Visits: 836
Comments posted to this topic are about the item Who was that Affinity Masked Man?

Craig Outcalt



Tips for new DBAs: http://www.sqlservercentral.com/articles/Career/64632
My other articles: http://www.sqlservercentral.com/Authors/Articles/Craig_Outcalt/560258
Anipaul
Anipaul
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6277 Visits: 1407
Cool Cool article. Smile



Andrew..Peterson
Andrew..Peterson
Old Hand
Old Hand (342 reputation)Old Hand (342 reputation)Old Hand (342 reputation)Old Hand (342 reputation)Old Hand (342 reputation)Old Hand (342 reputation)Old Hand (342 reputation)Old Hand (342 reputation)

Group: General Forum Members
Points: 342 Visits: 683
Nice job

The more you are prepared, the less you need it.
scott vandenelzen
scott vandenelzen
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 45
the code posted we incomplete. can we get the entire thing Smile
Ryan C. Price
Ryan C. Price
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 1173
Ok, so I'm a (posting) noob on this site, but aren't loops discouraged in these forums?

If you have a zero-based Tally table, you can replace your initializer and loop with something like:


INSERT INTO @PROCMASKSTABLE
SELECT CAST(c.value AS INT) & Bits.BitMask AS Mask
FROM sys.configurations AS c CROSS JOIN
(SELECT Number AS BitNo, CAST(POWER(2.0, Number) AS BIGINT) AS BitMask
FROM Tally WHERE (Number <= @NUMPROCS and Number <= 31)) AS Bits
WHERE (c.name = 'affinity mask')



not saying it's any faster, but the anti-loop people will like it much better Smile

Also, I think your code will fail on processor 32 (bit 31), because you'll get an integer overflow - try this and see what I mean:
select 1073741824 * 2 -- 1073741824 == 2^30



you need to use a BIGINT.

Also, although I also can't test it, because I don't have more than 32 processors, I think the Affinity64 mask is also a 32-bit number,
for processors 32 through 63, and that you need to use the same logic as for the first 32, and add 32 to resulting numbers...

/Ryan
SQLBOT
SQLBOT
SSChasing Mays
SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)

Group: General Forum Members
Points: 660 Visits: 836
That's pretty tight, thanks Ryan.

I don't use tally but I might investigate it. Something about adding a table to avoid loops smells a tad like hackery to this robot Smile


Great catch on the int overflow. I'll try to update the article.

Craig Outcalt



Tips for new DBAs: http://www.sqlservercentral.com/articles/Career/64632
My other articles: http://www.sqlservercentral.com/Authors/Articles/Craig_Outcalt/560258
SQLBOT
SQLBOT
SSChasing Mays
SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)

Group: General Forum Members
Points: 660 Visits: 836
scott vandenelzen (10/24/2008)
the code posted we incomplete. can we get the entire thing Smile


IT's all there. Did you see the scroll bar in the code section?

Craig Outcalt



Tips for new DBAs: http://www.sqlservercentral.com/articles/Career/64632
My other articles: http://www.sqlservercentral.com/Authors/Articles/Craig_Outcalt/560258
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search