Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Who was that Affinity Masked Man? Expand / Collapse
Author
Message
Posted Friday, October 17, 2008 12:30 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, January 3, 2014 10:59 AM
Points: 626, 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
Post #587438
Posted Friday, October 17, 2008 12:55 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, July 17, 2014 10:36 PM
Points: 5,300, Visits: 1,378
Cool Cool article. :)


Post #587450
Posted Saturday, October 18, 2008 8:25 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 10:54 AM
Points: 162, Visits: 318
Nice job

The more you are prepared, the less you need it.
Post #588129
Posted Friday, October 24, 2008 7:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 11, 2013 12:31 PM
Points: 3, Visits: 39
the code posted we incomplete. can we get the entire thing :)
Post #591172
Posted Monday, October 27, 2008 11:35 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: 2 days ago @ 7:18 PM
Points: 56, Visits: 1,038
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 :)

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
Post #592629
Posted Tuesday, October 28, 2008 7:15 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, January 3, 2014 10:59 AM
Points: 626, 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 :)


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
Post #592855
Posted Tuesday, October 28, 2008 7:16 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, January 3, 2014 10:59 AM
Points: 626, Visits: 836
scott vandenelzen (10/24/2008)
the code posted we incomplete. can we get the entire thing :)


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
Post #592856
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse